From: Michał Kępień Date: Mon, 14 Dec 2015 12:15:19 +0000 (+0100) Subject: Fix Base64 decoding for dnsdist on big endian platforms X-Git-Tag: dnsdist-1.0.0-alpha1~56^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3035%2Fhead;p=thirdparty%2Fpdns.git Fix Base64 decoding for dnsdist on big endian platforms --- diff --git a/pdns/sodcrypto.cc b/pdns/sodcrypto.cc index f212958018..e26e2b5073 100644 --- a/pdns/sodcrypto.cc +++ b/pdns/sodcrypto.cc @@ -219,9 +219,15 @@ int B64Decode(const std::string& strInput, std::string& strOutput) // Interpret the resulting 3 bytes...note there // may have been padding, so those padded bytes // are actually ignored. +#if BYTE_ORDER == BIG_ENDIAN + strOutput += pBuf[sizeof(long)-3]; + strOutput += pBuf[sizeof(long)-2]; + strOutput += pBuf[sizeof(long)-1]; +#else strOutput += pBuf[2]; strOutput += pBuf[1]; strOutput += pBuf[0]; +#endif } // while if(pad) strOutput.resize(strOutput.length()-pad);