Ensure there's room for a trailing 0
authorAlan T. DeKok <aland@freeradius.org>
Mon, 1 Dec 2008 09:40:24 +0000 (10:40 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 1 Dec 2008 16:47:24 +0000 (17:47 +0100)
This address Coverity #70.  I don't think it will ever happen
due to the way the strings are being handled, but it never hurts
to be safe...

src/main/xlat.c

index 1315894..934b98c 100644 (file)
@@ -660,8 +660,8 @@ static void decode_attribute(const char **from, char **to, int freespace,
                 */
                int len1, len2;
                size_t mylen = strlen(p);
-               char *first = rad_malloc(mylen);
-               char *second = rad_malloc(mylen);
+               char *first = rad_malloc(mylen + 1);
+               char *second = rad_malloc(mylen + 1);
                int expand2 = FALSE;
 
                len1 = rad_copy_variable(first, p);