Treat large argument as error in UpnpAddVirtualDir.
(cherry picked from commit e4678168fa8564e788293ef764dc3265f89484bc)
This commit is contained in:
parent
17e1f6aa09
commit
37b0afe1dc
@ -322,6 +322,7 @@ Version 1.6.16
|
||||
|
||||
Further measures against buffer overflows.
|
||||
|
||||
Treat large argument as error in UpnpAddVirtualDir.
|
||||
Do not clear buffer before snprintf.
|
||||
|
||||
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||
|
@ -3979,9 +3979,13 @@ int UpnpAddVirtualDir(const char *newDirName)
|
||||
}
|
||||
|
||||
if( *newDirName != '/' ) {
|
||||
if (strlen(newDirName) > sizeof(dirName) - 2)
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
dirName[0] = '/';
|
||||
strncpy( dirName + 1, newDirName, sizeof( dirName ) - 2 );
|
||||
} else {
|
||||
if (strlen(newDirName) > sizeof(dirName) - 1)
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
strncpy( dirName, newDirName, sizeof( dirName ) - 1 );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user