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: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57bec1a5eddbed3454d7a439b67fabe7dc7c4906;p=pdns Fix Base64 decoding for dnsdist on big endian platforms --- diff --git a/pdns/sodcrypto.cc b/pdns/sodcrypto.cc index f21295801..e26e2b507 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);