From 57bec1a5eddbed3454d7a439b67fabe7dc7c4906 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 14 Dec 2015 13:15:19 +0100 Subject: [PATCH] Fix Base64 decoding for dnsdist on big endian platforms --- pdns/sodcrypto.cc | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.47.2