From: Russell Bryant Date: Mon, 15 Oct 2007 12:48:10 +0000 (+0000) Subject: Make sure that the base64 decoder returns a terminated string. X-Git-Tag: 1.4.14~161 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b382ca76f0dfd0325d9a32c475f4e0cc7839c3f;p=thirdparty%2Fasterisk.git Make sure that the base64 decoder returns a terminated string. (closes issue #10979) Reported by: ys Patches: util.c.diff uploaded by ys (license 281) - small mods by me git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85543 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/utils.c b/main/utils.c index 61fb8a194c..5d4bd1cdcc 100644 --- a/main/utils.c +++ b/main/utils.c @@ -347,6 +347,9 @@ int ast_base64decode(unsigned char *dst, const char *src, int max) cnt++; } } + if (cnt == max) + dst--; + *dst = '\0'; /* Dont worry about left over bits, they're extra anyway */ return cnt; }