From 2b3f5bbceef7ab5203ea96ab2b6f039c9598548a Mon Sep 17 00:00:00 2001 From: Yoichi NAKAYAMA Date: Sat, 10 Mar 2012 22:29:44 +0900 Subject: [PATCH] Fix buffer size for strncpy in UpnpAddVirtualDir() Since 1st argument precedes the beginning of the buffer, it is necessary to reduce the value of 3rd argument. (cherry picked from commit b78eaf4e4374684847c4b5e1d62cb5a0a2541d9a) --- upnp/src/api/upnpapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upnp/src/api/upnpapi.c b/upnp/src/api/upnpapi.c index 40c6947..77ced00 100644 --- a/upnp/src/api/upnpapi.c +++ b/upnp/src/api/upnpapi.c @@ -3980,7 +3980,7 @@ int UpnpAddVirtualDir(const char *newDirName) if( *newDirName != '/' ) { dirName[0] = '/'; - strncpy( dirName + 1, newDirName, sizeof( dirName ) - 1 ); + strncpy( dirName + 1, newDirName, sizeof( dirName ) - 2 ); } else { strncpy( dirName, newDirName, sizeof( dirName ) - 1 ); }