From af396a54496fd340081d82ba11f576cac81c9ccb Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Wed, 27 Nov 2002 04:44:24 +0000 Subject: [PATCH] fix bug in local_strcat() --- src/metaflac/utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/metaflac/utils.c b/src/metaflac/utils.c index 07edba2..3d57f9b 100644 --- a/src/metaflac/utils.c +++ b/src/metaflac/utils.c @@ -50,13 +50,13 @@ void local_strcat(char **dest, const char *source) ndest = *dest? strlen(*dest) : 0; nsource = strlen(source); - *dest = realloc(*dest, ndest + nsource); + if(nsource == 0) + return; + + *dest = realloc(*dest, ndest + nsource + 1); if(0 == *dest) die("out of memory growing string"); - if(0 == ndest) - strcpy(*dest, source); - else - strcat(*dest, source); + strcpy((*dest)+ndest, source); } void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const char *indent) -- 2.7.4