Improve allocation bounds in testing
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
a1b2bfff46
commit
716163e824
1 changed files with 2 additions and 2 deletions
|
@ -125,8 +125,8 @@ void pkcs7_verify(char *pkcs7_file,
|
|||
TEST_ASSERT(file != NULL);
|
||||
|
||||
datalen = st.st_size;
|
||||
/* Add 1 so that data is non-NULL for zero length input */
|
||||
ASSERT_ALLOC(data, datalen + 1);
|
||||
/* Special-case for zero-length input so that data will be non-NULL */
|
||||
ASSERT_ALLOC(data, datalen == 0 ? 1 : datalen);
|
||||
buflen = fread((void *) data, sizeof(unsigned char), datalen, file);
|
||||
TEST_EQUAL(buflen, datalen);
|
||||
|
||||
|
|
Loading…
Reference in a new issue