]> granicus.if.org Git - pdns/commitdiff
Fix Base64 decoding for dnsdist on big endian platforms
authorMichał Kępień <github@kempniu.pl>
Mon, 14 Dec 2015 12:15:19 +0000 (13:15 +0100)
committerMichał Kępień <github@kempniu.pl>
Mon, 14 Dec 2015 12:26:55 +0000 (13:26 +0100)
pdns/sodcrypto.cc

index f212958018493a90390f146075252a28bdabb36c..e26e2b50739784fe879007638baca15e6b776a83 100644 (file)
@@ -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);