[PATCH] [static analyzer] Emit buffer overflow warning in strcpy fucntion when uninitialized source array of known length(> dest length) is used

Mayur Pandey mayur.p at samsung.com
Tue Oct 28 02:49:49 PDT 2014


Hi krememek, zaks.anna, jordan_rose,

Enable static analyzer to throw warnings when uninitialized source array of known length is given as the argument to strcpy function, where dest size < source size.
char x[3] = "abc";
char y[4];
strcpy(x,y); // emit buffer overflow warning

http://reviews.llvm.org/D6012

Files:
  lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  test/Analysis/string.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6012.15519.patch
Type: text/x-patch
Size: 3351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141028/def3bde5/attachment.bin>


More information about the cfe-commits mailing list