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)
|
* 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
|
* This file contains implementation of the catdup() function
|
||||||
|
@ -185,8 +185,11 @@ char * catdup_array(const char ** array, const char * delimiter)
|
||||||
len = strlen(array[i]);
|
len = strlen(array[i]);
|
||||||
memcpy(p, array[i], len);
|
memcpy(p, array[i], len);
|
||||||
p += len;
|
p += len;
|
||||||
memcpy(p, delimiter, delimiter_length);
|
if (delimiter_length > 0)
|
||||||
p += delimiter_length;
|
{
|
||||||
|
memcpy(p, delimiter, delimiter_length);
|
||||||
|
p += delimiter_length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
|
Loading…
Reference in New Issue