cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Fix strcpy memory overlap false negative

Open psimovec opened this issue 4 years ago • 0 comments

Cppcheck does not report undefined behavior of strcpy memory overlap, however it reports the problem for strncpy.

I have found the commit where the new feature for strncpy is added, with a possibly relevant comment: https://github.com/danmar/cppcheck/commit/6234b5438ee1be035e9581c3367f037bf66bac42#commitcomment-53225278

So far I have added tests with expected behavior, which should clarify the problem.

The next step will be trying to remove the false negative.

psimovec avatar Oct 13 '21 14:10 psimovec