check buffer is larger enough before overwriting
This commit is contained in:
parent
2ab42de1ec
commit
f2c358c6ce
@ -168,10 +168,9 @@ int fbytes(unsigned char *buf, int num)
|
||||
return 0;
|
||||
}
|
||||
fbytes_counter ++;
|
||||
ret = BN_bn2bin(tmp, buf);
|
||||
if (ret == 0 || ret != num)
|
||||
if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf))
|
||||
ret = 0;
|
||||
else
|
||||
else
|
||||
ret = 1;
|
||||
if (tmp)
|
||||
BN_free(tmp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user