Account for length without null inclusion
This commit is contained in:
		| @@ -20,8 +20,6 @@ | |||||||
|  *  |  *  | ||||||
|  ***********************************************************************/ |  ***********************************************************************/ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <memory.h> | #include <memory.h> | ||||||
|  |  | ||||||
| @@ -52,8 +50,6 @@ static SS_UTF8_T	SSCS_OBITUARY_DELIMITED[] = {"SS_Obituary:"}; | |||||||
| #define	sscsshs_AddSHSBinaryEntry	sscsshs_AddSHSEntry | #define	sscsshs_AddSHSBinaryEntry	sscsshs_AddSHSEntry | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * NAME - sscsshs_AddSHSEntry |  * NAME - sscsshs_AddSHSEntry | ||||||
|  * |  * | ||||||
| @@ -1579,6 +1575,16 @@ miCASAWriteKey | |||||||
| 		return(NSSCS_E_BUFFER_LEN); | 		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)  | 	if((escapedSHSName = (SS_UTF8_T *) malloc(NSSCS_MAX_SECRET_ID_LEN)) == NULL)  | ||||||
| 	{ | 	{ | ||||||
| @@ -1598,7 +1604,6 @@ miCASAWriteKey | |||||||
| 		goto errorLevel1; | 		goto errorLevel1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	memset(secretID.id, 0, NSSCS_MAX_SECRET_ID_LEN); | 	memset(secretID.id, 0, NSSCS_MAX_SECRET_ID_LEN); | ||||||
| 	memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN); | 	memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN); | ||||||
| 	memset(escapedSHSKey, 0, NSSCS_MAX_SECRET_ID_LEN); | 	memset(escapedSHSKey, 0, NSSCS_MAX_SECRET_ID_LEN); | ||||||
| @@ -3219,7 +3224,16 @@ miCASASetCredential | |||||||
| 		return NSSCS_E_BUFFER_LEN; | 		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 | 	// open secretStore | ||||||
| 	sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN); | 	sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN); | ||||||
| @@ -3265,6 +3279,7 @@ miCASASetCredential | |||||||
| 		basicCred = (SSCS_BASIC_CREDENTIAL *)credential;				 | 		basicCred = (SSCS_BASIC_CREDENTIAL *)credential;				 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	// determine username key name, ie CN, LDAPDN, etc | 	// determine username key name, ie CN, LDAPDN, etc | ||||||
| 	if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F) | 	if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F) | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user