You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seedlen += entropy_len;
if(nonce_len != 0)
seedlen += nonce_len;
if(additional != NULL && len != 0){
memcpy(seed + seedlen, additional, len);
seedlen += len;
}
}
int main()
{
unsigned char arr[20] = {0};
test(arr, 8, 0, 5);
return 0;
}
Infer:31: error: Buffer Overrun L2
Offset added: [13, 24] (⇐ [5, 16] + 8) Size: 16 by call to test.
29. {
30. unsigned char arr[20] = {0};
31. test(arr, 8, 0, 5);
^
32. return 0;
33. }
A call to the main function may not cause the array of the called function to go out of bounds
The text was updated successfully, but these errors were encountered:
wbhqmzl
changed the title
false positive
Is this feedback correct?
Apr 22, 2024
#define MAX_LEN (16)
void test(const unsigned char *additional, size_t len, size_t nonce_len, size_t entropy_len)
{
unsigned char seed[MAX_LEN];
size_t seedlen = 0;
if(entropy_len > MAX_LEN)
return;
if(nonce_len > MAX_LEN - entropy_len)
return;
if(len > MAX_LEN - entropy_len - nonce_len)
return;
seedlen += entropy_len;
if(nonce_len != 0)
seedlen += nonce_len;
if(additional != NULL && len != 0){
memcpy(seed + seedlen, additional, len);
seedlen += len;
}
}
int main()
{
unsigned char arr[20] = {0};
test(arr, 8, 0, 5);
return 0;
}
Infer:31: error: Buffer Overrun L2
Offset added: [13, 24] (⇐ [5, 16] + 8) Size: 16 by call to
test
.29. {
30. unsigned char arr[20] = {0};
31. test(arr, 8, 0, 5);
^
32. return 0;
33. }
A call to the main function may not cause the array of the called function to go out of bounds
The text was updated successfully, but these errors were encountered: