]> granicus.if.org Git - pdns/commitdiff
fix base64 decoding for big endian archs on which long is not 32 bits (like s390x)
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Tue, 22 Oct 2013 21:26:13 +0000 (23:26 +0200)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Tue, 26 Nov 2013 11:26:31 +0000 (12:26 +0100)
pdns/base64.cc

index ab10c7ee687b7551465f0f49a26160276f38b070..f7f04224425e0dc2f3cf66aecbca8a5d6f46542f 100644 (file)
@@ -165,9 +165,9 @@ int B64Decode(const std::string& strInput, std::string& strOutput)
     // may have been padding, so those padded bytes
     // are actually ignored.
 #if BYTE_ORDER == BIG_ENDIAN
-    strOutput += pBuf[1];
-    strOutput += pBuf[2];
-    strOutput += pBuf[3];
+    strOutput += pBuf[sizeof(long)-3];
+    strOutput += pBuf[sizeof(long)-2];
+    strOutput += pBuf[sizeof(long)-1];
 #else
     strOutput += pBuf[2];
     strOutput += pBuf[1];