Skip to content

Commit

Permalink
Merge pull request Mbed-TLS#390 from pabuhler/coverity-scan-179781
Browse files Browse the repository at this point in the history
bitvector of length zero is not valid
  • Loading branch information
pabuhler authored Nov 29, 2017
2 parents 8f38517 + b44764b commit 03e237e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crypto/math/datatypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,11 @@ int bitvector_alloc(bitvector_t *v, unsigned long length)
l = length / bits_per_word * bytes_per_word;

/* allocate memory, then set parameters */
if (l == 0)
if (l == 0) {
v->word = NULL;
else {
v->length = 0;
return -1;
} else {
v->word = (uint32_t *)srtp_crypto_alloc(l);
if (v->word == NULL) {
v->length = 0;
Expand Down

0 comments on commit 03e237e

Please sign in to comment.