diff --git a/ChangeLog b/ChangeLog index 253af6e..1929d46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -318,6 +318,13 @@ Version 1.8.0 Version 1.6.16 ******************************************************************************* +2012-03-10 Yoichi NAKAYAMA + + 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 Synchronize autoconfig.h with upnpconfig.h. diff --git a/upnp/src/api/UpnpString.c b/upnp/src/api/UpnpString.c index a5d43cb..9fe8f93 100644 --- a/upnp/src/api/UpnpString.c +++ b/upnp/src/api/UpnpString.c @@ -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;