##// END OF EJS Templates
check-code: prevent use of strcpy
Augie Fackler -
r28594:d3990da5 default
parent child Browse files
Show More
@@ -359,6 +359,7 cpats = [
359 359 (r'^#\s+\w', "use #foo, not # foo"),
360 360 (r'[^\n]\Z', "no trailing newline"),
361 361 (r'^\s*#import\b', "use only #include in standard C code"),
362 (r'strcpy\(', "don't use strcpy, use strlcpy or memcpy"),
362 363 ],
363 364 # warnings
364 365 []
@@ -69,6 +69,22
69 69 dict() is different in Py2 and 3 and is slower than {}
70 70 [1]
71 71
72 $ cat > foo.c <<EOF
73 > void narf() {
74 > strcpy(foo, bar);
75 > // strcpy_s is okay, but this comment is not
76 > strcpy_s(foo, bar);
77 > }
78 > EOF
79 $ "$check_code" ./foo.c
80 ./foo.c:2:
81 > strcpy(foo, bar);
82 don't use strcpy, use strlcpy or memcpy
83 ./foo.c:3:
84 > // strcpy_s is okay, but this comment is not
85 don't use //-style comments
86 [1]
87
72 88 $ cat > is-op.py <<EOF
73 89 > # is-operator comparing number or string literal
74 90 > x = None
General Comments 0
You need to be logged in to leave comments. Login now