Click on image to see enlargment
Our programmer wants to change all file names that bear the word "shower" into ones where that word is changed to "flower". But there's a flaw. Can you spot it? (Note, you need two passes using our product to catch the flaw.)
bug419.cpp lint Output
--- Module: bug419.cpp (C++) _ while( p = strstr( buf, "shower" ) ) bug419.cpp(10) : Info 720: Boolean test of assignment /// Start of Pass 2 /// --- Module: bug419.cpp (C++) During Specific Walk: File bug419.cpp line 19: cvt(!=0) bug419.cpp(9) : Warning 419: Apparent data overrun for function 'strcpy(char *, const char *)', argument 2 (size=13) exceeds argument 1 (size=12) [Reference: file bug419.cpp: lines 9, 19]
Reference Manual Explanation
419 Apparent data overrun for function 'Symbol', argument Integer exceeds argument Integer -- This message is for data transfer functions such as memcpy, strcpy, fgets, etc. when the size indicated by the first cited argument (or arguments) exceeds the size of the buffer area cited by the second. The message may also be issued for user functions via the -function option. See §10.1 "Function Mimicry" and §10.2.1 "Possible Semantics".
If you have comments or questions about this bug, please post them to our Discussion Forum
Previous Bug - Bug #627 - March 2006