@@ -42,83 +42,83 @@ const char *const_wash(char *str) {
4242
4343int main (int argc, char **argv) {
4444 const char *message = messages[2 ];
45- printf (choose_message (argc - 1 ), argc - 1 ); // OK
46- printf (messages[1 ]); // OK
47- printf (message); // OK
48- printf (make_message (argc - 1 )); // NOT OK
49- printf (" Hello, World\n " ); // OK
50- printf (_ (" Hello, World\n " )); // OK
45+ printf (choose_message (argc - 1 ), argc - 1 ); // GOOD
46+ printf (messages[1 ]); // GOOD
47+ printf (message); // GOOD
48+ printf (make_message (argc - 1 )); // BAD
49+ printf (" Hello, World\n " ); // GOOD
50+ printf (_ (" Hello, World\n " )); // GOOD
5151 {
5252 char hello[] = " hello, World\n " ;
5353 hello[0 ] = ' H' ;
54- printf (hello); // NOT OK
55- printf (_ (hello)); // OK
56- printf (gettext (hello)); // OK
57- printf (const_wash (hello)); // NOT OK
58- printf ((hello + 1 ) + 1 ); // NOT OK
59- printf (+hello); // NOT OK
60- printf (*&hello); // NOT OK
61- printf (&*hello); // NOT OK
62- printf ((char *)(void *)+(hello+1 ) + 1 ); // NOT OK
54+ printf (hello); // BAD
55+ printf (_ (hello)); // GOOD
56+ printf (gettext (hello)); // GOOD
57+ printf (const_wash (hello)); // BAD
58+ printf ((hello + 1 ) + 1 ); // BAD
59+ printf (+hello); // BAD
60+ printf (*&hello); // BAD
61+ printf (&*hello); // BAD
62+ printf ((char *)(void *)+(hello+1 ) + 1 ); // BAD
6363 }
64- printf ((" Hello, World\n " + 1 ) + 1 ); // NOT OK
64+ printf ((" Hello, World\n " + 1 ) + 1 ); // BAD
6565 {
6666 const char *hello = " Hello, World\n " ;
67- printf (hello + 1 ); // NOT OK
68- printf (hello); // OK
67+ printf (hello + 1 ); // BAD
68+ printf (hello); // GOOD
6969 }
7070 {
7171 const char *hello = " Hello, World\n " ;
7272 hello += 1 ;
73- printf (hello); // NOT OK
73+ printf (hello); // BAD
7474 }
7575 {
7676 // Same as above block but using "x = x + 1" syntax
7777 const char *hello = " Hello, World\n " ;
7878 hello = hello + 1 ;
79- printf (hello); // NOT OK
79+ printf (hello); // BAD
8080 }
8181 {
8282 // Same as above block but using "x++" syntax
8383 const char *hello = " Hello, World\n " ;
8484 hello++;
85- printf (hello); // NOT OK
85+ printf (hello); // BAD
8686 }
8787 {
8888 // Same as above block but using "++x" as subexpression
8989 const char *hello = " Hello, World\n " ;
90- printf (++hello); // NOT OK
90+ printf (++hello); // BAD
9191 }
9292 {
9393 // Same as above block but through a pointer
9494 const char *hello = " Hello, World\n " ;
9595 const char **p = &hello;
9696 (*p)++;
97- printf (hello); // NOT OK [NOT DETECTED]
97+ printf (hello); // BAD [NOT DETECTED]
9898 }
9999 {
100100 // Same as above block but through a C++ reference
101101 const char *hello = " Hello, World\n " ;
102102 const char *&p = hello;
103103 p++;
104- printf (hello); // NOT OK [NOT DETECTED]
104+ printf (hello); // BAD [NOT DETECTED]
105105 }
106106 if (gettext_debug) {
107- printf (new char [100 ]); // NOT OK
107+ printf (new char [100 ]); // BAD
108108 }
109109 {
110110 const char *hello = " Hello, World\n " ;
111111 const char *const *p = &hello; // harmless reference to const pointer
112- printf (hello); // OK
112+ printf (hello); // GOOD
113113 hello++; // modification comes after use and so does no harm
114114 }
115- printf (argc > 2 ? " More than one\n " : _ (" Only one\n " )); // OK
115+ printf (argc > 2 ? " More than one\n " : _ (" Only one\n " )); // GOOD
116116
117117 // This following is OK since a const literal is passed to const_wash()
118118 // and the taint tracker detects this.
119119 //
120120 //
121- printf (const_wash (" Hello, World\n " )); // OK
121+ printf (const_wash (" Hello, World\n " )); // GOOD
122122}
123123
124124const char *simple_func (const char *str) {
@@ -127,9 +127,9 @@ const char *simple_func(const char *str) {
127127
128128void another_func (void ) {
129129 const char *message = messages[2 ];
130- printf (simple_func (" Hello, World\n " )); // OK
131- printf (messages[1 ]); // OK
132- printf (message); // OK
133- printf (" Hello, World\n " ); // OK
134- printf (gettext (" Hello, World\n " )); // OK
130+ printf (simple_func (" Hello, World\n " )); // GOOD
131+ printf (messages[1 ]); // GOOD
132+ printf (message); // GOOD
133+ printf (" Hello, World\n " ); // GOOD
134+ printf (gettext (" Hello, World\n " )); // GOOD
135135}
0 commit comments