From 0c3742099d6f94a8928ac5e6eca11f8d3f4cb3ad Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Tue, 22 Oct 2013 23:26:13 +0200 Subject: [PATCH] fix base64 decoding for big endian archs on which long is not 32 bits (like s390x) --- pdns/base64.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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]; -- 2.47.2