From: bert hubert Date: Sun, 14 Jul 2013 08:27:06 +0000 (+0200) Subject: for ages... we messed up base64 decoding on big endian platforms. The shame. X-Git-Tag: rec-3.6.0-rc1~566 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b969c229e1fe9a88e6ff6b68af461d15649fdf75;p=thirdparty%2Fpdns.git for ages... we messed up base64 decoding on big endian platforms. The shame. --- diff --git a/pdns/base64.cc b/pdns/base64.cc index b3712d18e1..ab10c7ee68 100644 --- a/pdns/base64.cc +++ b/pdns/base64.cc @@ -1,6 +1,6 @@ #include "base64.hh" #include - +#include "dns.hh" namespace anonpdns { char B64Decode1(char cInChar) { @@ -164,9 +164,16 @@ 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[1]; + strOutput += pBuf[2]; + strOutput += pBuf[3]; +#else strOutput += pBuf[2]; strOutput += pBuf[1]; strOutput += pBuf[0]; +#endif + } // while if(pad) strOutput.resize(strOutput.length()-pad);