From 51da351af723d56bf33595a03fdcf04f36f8388f Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Wed, 26 Apr 2006 21:38:59 +0000 Subject: [PATCH] Security Audit 5:13. Use proper length on strncpy. --- CASA.changes | 4 ++++ c_adlib/ad_gk/native/ad_gk.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CASA.changes b/CASA.changes index 136fa4bd..29a0269f 100644 --- a/CASA.changes +++ b/CASA.changes @@ -1,3 +1,7 @@ +------------------------------------------------------------------- +Wed Apr 26 15:39:00 MST 2006 - jnorman@novell.com +- Security Audit 5:13. Use proper length on strncpy. + ------------------------------------------------------------------- Wed Apr 26 11:02:00 MST 2006 - jnorman@novell.com - Security Audit 5.6: Check length of ssNameLen < 256 diff --git a/c_adlib/ad_gk/native/ad_gk.c b/c_adlib/ad_gk/native/ad_gk.c index 6ae7b528..ff79173d 100644 --- a/c_adlib/ad_gk/native/ad_gk.c +++ b/c_adlib/ad_gk/native/ad_gk.c @@ -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);