fix potential access of NULL pointer
It could happen if delimiter is NULL. Currently the only use is with non-NULL delimiter.
This commit is contained in:
parent
c2fc519d5c
commit
6b3524b6a6
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* LADI Session Handler (ladish)
|
||||
*
|
||||
* Copyright (C) 2009,2010 Nedko Arnaudov <nedko@arnaudov.name>
|
||||
* Copyright (C) 2009,2010,2012 Nedko Arnaudov <nedko@arnaudov.name>
|
||||
*
|
||||
**************************************************************************
|
||||
* This file contains implementation of the catdup() function
|
||||
|
@ -185,9 +185,12 @@ char * catdup_array(const char ** array, const char * delimiter)
|
|||
len = strlen(array[i]);
|
||||
memcpy(p, array[i], len);
|
||||
p += len;
|
||||
if (delimiter_length > 0)
|
||||
{
|
||||
memcpy(p, delimiter, delimiter_length);
|
||||
p += delimiter_length;
|
||||
}
|
||||
}
|
||||
|
||||
*p = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue