aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-15 12:48:10 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-15 12:48:10 +0000
commita6f1dc000a8ccd3a09cf0bde7f13742f1e18c554 (patch)
treeb217901a52bc09f3e5172f6a12f2f41b540bdc24
parent062af3bf382a8c11deef4e7f1d44dbd134c63918 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@85543 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index 61fb8a194..5d4bd1cdc 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;
}