mirror of https://github.com/xiph/flac
Fix strlen being used on uninitialized data
This commit is contained in:
parent
cad22e0e3a
commit
5f39e88a88
|
@ -76,6 +76,11 @@ void local_strcat(char **dest, const char *source)
|
|||
*dest = safe_realloc_add_3op_(*dest, ndest, /*+*/nsource, /*+*/1);
|
||||
if(*dest == NULL)
|
||||
die("out of memory growing string");
|
||||
/* If ndest == 0, strlen in safe_strncat reads
|
||||
* uninitialized data. To prevent that, set first character
|
||||
* to zero */
|
||||
if(ndest == 0)
|
||||
*dest[0] = 0;
|
||||
safe_strncat(*dest, source, outlen);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue