flawfinder icon indicating copy to clipboard operation
flawfinder copied to clipboard

if (!strncasecmp(arg, "file://", strlen("file://"))) throws an issue #21

Open vtorri opened this issue 3 years ago • 2 comments

https://app.codacy.com/gh/vtorri/entice/issues?categoryType=Security

FCodacy findd potential security problems in strlen calls :

Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126)

code :

if (!strncasecmp(arg, "file://", strlen("file://")))

but strlen("file://") is always 7 as we pass a static string which is always correctly 0-terminated

vtorri avatar May 10 '21 10:05 vtorri

I could probably work up a pull request, at least for the simplest case of a single double-quoted string argument. I will need to understand the unit tests, so I can add a proper unit test for the exception as well.

dwvisser avatar Dec 22 '21 15:12 dwvisser

@dwvisser - that would be awesome!

david-a-wheeler avatar Dec 22 '21 16:12 david-a-wheeler