Skip to content

Commit d71776a

Browse files
coverity CID 352930, fix for out of bounds write
1 parent abd7449 commit d71776a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wolfcrypt/src/tfm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,9 @@ void fp_mod_2d(fp_int *a, int b, fp_int *c)
11041104

11051105
bmax = ((unsigned int)b + DIGIT_BIT - 1) / DIGIT_BIT;
11061106

1107-
/* If a is negative and bmax is larger than FP_SIZE, then the
1107+
/* If a is negative and bmax is greater than or equal to FP_SIZE, then the
11081108
* result can't fit within c. Just return. */
1109-
if (c->sign == FP_NEG && bmax > FP_SIZE) {
1109+
if (c->sign == FP_NEG && bmax >= FP_SIZE) {
11101110
return;
11111111
}
11121112

0 commit comments

Comments
 (0)