Handle allocation error in strndup to avoid access violation.
Return NULL before calling strncpy. Platforms with HAVE_STRNDUP are not affected. (cherry picked from commit 194397b6d62b0a9910075ec07ecb77df6929abc8)
This commit is contained in:
parent
2b3f5bbcee
commit
6ea4cc41ef
@ -318,6 +318,13 @@ Version 1.8.0
|
||||
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>
|
||||
|
||||
Synchronize autoconfig.h with upnpconfig.h.
|
||||
|
@ -50,6 +50,8 @@
|
||||
{
|
||||
size_t strsize = strnlen(__string, __n);
|
||||
char *newstr = (char *)malloc(strsize + 1);
|
||||
if (newstr == NULL)
|
||||
return NULL;
|
||||
|
||||
strncpy(newstr, __string, strsize);
|
||||
newstr[strsize] = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user