When I perform a strcpy to a char[]:
char buf[100];
strcpy(buf[], largeInput);
If largeInput is longer than 100 bytes we have a buffer overflow.
However I have a question, if buf
, instead of being a char[]
is a char
pointer, would there be a buffer overflow as well?
I think, if largeInput
is long enough, when copied to char *buf
, it could reach a memory zone of another variable. However I'm not sure this is a vulnerability.
I used flawfinder and it accused such code of being a buffer overflow vulnerability
char *buf;
strcpy(buf, largeInput);
I'm just not sure if it is a false positive or not.