Account for length without null inclusion

This commit is contained in:
Jim Norman 2006-04-28 21:25:05 +00:00
parent 4ee6c466c2
commit 7c24af851a

View File

@ -20,8 +20,6 @@
*
***********************************************************************/
#include <stdlib.h>
#include <memory.h>
@ -52,8 +50,6 @@ static SS_UTF8_T SSCS_OBITUARY_DELIMITED[] = {"SS_Obituary:"};
#define sscsshs_AddSHSBinaryEntry sscsshs_AddSHSEntry
/*
* NAME - sscsshs_AddSHSEntry
*
@ -1578,8 +1574,18 @@ miCASAWriteKey
{
return(NSSCS_E_BUFFER_LEN);
}
// check to see if caller included the null in length, if not add one
if (sscs_Utf8Strlen(key) == keyLen)
{
keyLen += 1;
}
if (strlen(val) == valLen)
{
valLen += 1;
}
if((escapedSHSName = (SS_UTF8_T *) malloc(NSSCS_MAX_SECRET_ID_LEN)) == NULL)
{
rc = NSSCS_E_SYSTEM_FAILURE;
@ -1598,7 +1604,6 @@ miCASAWriteKey
goto errorLevel1;
}
memset(secretID.id, 0, NSSCS_MAX_SECRET_ID_LEN);
memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN);
memset(escapedSHSKey, 0, NSSCS_MAX_SECRET_ID_LEN);
@ -3219,8 +3224,17 @@ miCASASetCredential
return NSSCS_E_BUFFER_LEN;
}
// check length to see if includes the null, add one if not
if ((sscs_Utf8Strlen(appSecretID->id) == appSecretID->len)
{
appSecretID += 1;
}
if ((sharedSecretID) && (sscs_Utf8Strlen(sharedSecretID->id) == sharedSecretID->len)
{
sharedSecretID->len += 1;
}
// open secretStore
sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN);
store.version = 1;
@ -3265,6 +3279,7 @@ miCASASetCredential
basicCred = (SSCS_BASIC_CREDENTIAL *)credential;
}
// determine username key name, ie CN, LDAPDN, etc
if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F)
{