Skip to content

Commit

Permalink
doh! properly handle case when src is empty - thanks valgrind!
Browse files Browse the repository at this point in the history
  • Loading branch information
gcottenc committed Nov 17, 2008
1 parent 56a9033 commit fef9979
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions server/tools.c
Expand Up @@ -111,12 +111,10 @@ void * memdup(void *src, size_t size)
size_t strconcat(char *dst, const char *src, size_t size)
{
char *ptr = dst + strlen(dst);
while (ptr - dst < size - 1) {
while (ptr - dst < size - 1 && *src) {
*ptr = *src;
ptr++;
src++;
if (!*src)
break;
}
*ptr = '\0';
return ptr - dst;
Expand Down

0 comments on commit fef9979

Please sign in to comment.