Permalink
Browse files

fix base64 decoding for big endian archs on which long is not 32 bits…

… (like s390x)
  • Loading branch information...
1 parent afdc59a commit 07b904e4947a0bae978d20903c13650253f3f2da @Habbie Habbie committed Oct 22, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 pdns/base64.cc
View
@@ -165,9 +165,9 @@ int B64Decode(const std::string& strInput, std::string& strOutput)
// 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];
+ strOutput += pBuf[sizeof(long)-3];
+ strOutput += pBuf[sizeof(long)-2];
+ strOutput += pBuf[sizeof(long)-1];
#else
strOutput += pBuf[2];
strOutput += pBuf[1];

0 comments on commit 07b904e

Please sign in to comment.