From: Peter van Dijk Date: Tue, 22 Oct 2013 21:26:13 +0000 (+0200) Subject: fix base64 decoding for big endian archs on which long is not 32 bits (like s390x) X-Git-Tag: auth-3.3.1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07b904e4947a0bae978d20903c13650253f3f2da;p=thirdparty%2Fpdns.git fix base64 decoding for big endian archs on which long is not 32 bits (like s390x) --- diff --git a/pdns/base64.cc b/pdns/base64.cc index ab10c7ee68..f7f0422442 100644 --- a/pdns/base64.cc +++ b/pdns/base64.cc @@ -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];