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: rec-3.6.0-rc1~385 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c3742099d6f94a8928ac5e6eca11f8d3f4cb3ad;p=pdns 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 ab10c7ee6..f7f042244 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];