Handle allocation error in strndup to avoid access violation.
Return NULL before calling strncpy. Platforms with HAVE_STRNDUP are not affected.
This commit is contained in:
parent
b78eaf4e43
commit
194397b6d6
@ -2,6 +2,13 @@
|
|||||||
Version 1.6.16
|
Version 1.6.16
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||||
|
|
||||||
|
Handle allocation error in strndup to avoid access violation.
|
||||||
|
|
||||||
|
Return NULL before calling strncpy.
|
||||||
|
Platforms with HAVE_STRNDUP are not affected.
|
||||||
|
|
||||||
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||||
|
|
||||||
Synchronize autoconfig.h with upnpconfig.h.
|
Synchronize autoconfig.h with upnpconfig.h.
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
{
|
{
|
||||||
size_t strsize = strnlen(__string, __n);
|
size_t strsize = strnlen(__string, __n);
|
||||||
char *newstr = (char *)malloc(strsize + 1);
|
char *newstr = (char *)malloc(strsize + 1);
|
||||||
|
if (newstr == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
strncpy(newstr, __string, strsize);
|
strncpy(newstr, __string, strsize);
|
||||||
newstr[strsize] = 0;
|
newstr[strsize] = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user