From: Jelte Jansen Date: Mon, 27 Mar 2006 09:10:23 +0000 (+0000) Subject: apparently if had forgotten to commit this: X-Git-Tag: release-1.1.0~278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b02c0b7dedcd56cc8a72234ea5e94aaefc9de6b3;p=thirdparty%2Fldns.git apparently if had forgotten to commit this: b64 zero length string special case --- diff --git a/compat/b64_ntop.c b/compat/b64_ntop.c index 60de5c98..b2ff41b9 100644 --- a/compat/b64_ntop.c +++ b/compat/b64_ntop.c @@ -130,6 +130,15 @@ b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { uint8_t input[3]; uint8_t output[4]; size_t i; + + if (srclength == 0) { + if (targsize > 0) { + target[0] = '\0'; + return 0; + } else { + return -1; + } + } while (2 < srclength) { input[0] = *src++; diff --git a/compat/b64_pton.c b/compat/b64_pton.c index e3ac4ef1..d705ece0 100644 --- a/compat/b64_pton.c +++ b/compat/b64_pton.c @@ -139,6 +139,10 @@ b64_pton(char const *src, uint8_t *target, size_t targsize) state = 0; tarindex = 0; + if (strlen(src) == 0) { + return 0; + } + while ((ch = *src++) != '\0') { if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ continue;