Security Audit 5:13. Use proper length on strncpy.
This commit is contained in:
@@ -756,8 +756,8 @@ void ItemGetInfoCb( GnomeKeyringResult result,
|
||||
if (itemlen > maxlen) {
|
||||
itemInfo->displayName = NULL;
|
||||
} else {
|
||||
strncpy(itemInfo->displayName, item, maxlen);
|
||||
itemInfo->displayName[maxlen] = '\0';
|
||||
strncpy(itemInfo->displayName, item, itemlen);
|
||||
itemInfo->displayName[itemlen] = '\0';
|
||||
}
|
||||
|
||||
/* maxlen = 255. This should be one less than the size of
|
||||
@@ -768,8 +768,8 @@ void ItemGetInfoCb( GnomeKeyringResult result,
|
||||
if (itemlen > maxlen) {
|
||||
itemInfo->secret = NULL;
|
||||
} else {
|
||||
strncpy(itemInfo->secret, item, maxlen);
|
||||
itemInfo->secret[maxlen] = '\0';
|
||||
strncpy(itemInfo->secret, item, itemlen);
|
||||
itemInfo->secret[itemlen] = '\0';
|
||||
}
|
||||
|
||||
itemInfo->mTime = gnome_keyring_item_info_get_mtime(info);
|
||||
|
||||
Reference in New Issue
Block a user