replace strlen() call with strnlen() and MAX_SPA_ENCODED_MSG_SIZE bound

This commit is contained in:
Michael Rash
2012-07-27 02:06:58 -04:00
parent 8471d8aae6
commit 16348aaccd
+4 -1
View File
@@ -41,9 +41,12 @@
static int
append_b64(char* tbuf, char *str)
{
int len = strlen(str);
int len = strnlen(str, MAX_SPA_ENCODED_MSG_SIZE);
char *bs;
if(len >= MAX_SPA_ENCODED_MSG_SIZE)
return(FKO_ERROR_INVALID_DATA);
bs = malloc(((len/3)*4)+8);
if(bs == NULL)
return(FKO_ERROR_MEMORY_ALLOCATION);