Skip to content

Commit

Permalink
crypto: testmgr - change guard to unsigned char
Browse files Browse the repository at this point in the history
When char is signed, storing the values 0xba (186) and 0xad (173) in the
`guard` array produces signed overflow. Change the type of `guard` to
static unsigned char to correct undefined behavior and reduce function
stack usage.

Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Joey Pabalinas authored and Herbert Xu committed Jan 12, 2018
1 parent 7660b1f commit da1729c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/testmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static int ahash_partial_update(struct ahash_request **preq,
char *state;
struct ahash_request *req;
int statesize, ret = -EINVAL;
const char guard[] = { 0x00, 0xba, 0xad, 0x00 };
static const unsigned char guard[] = { 0x00, 0xba, 0xad, 0x00 };

req = *preq;
statesize = crypto_ahash_statesize(
Expand Down

0 comments on commit da1729c

Please sign in to comment.