Menu

#5 WaE in gutcheck and one printf bug

Unstable (example)
open
nobody
None
5
2013-08-28
2013-08-28
Anonymous
No

Compiling gutchecks gives:

$ gcc -O2 gutcheck.c -o gutcheck
gutcheck.c: In function 'main':
gutcheck.c:530:33: warning: format '%d' expects a matching 'int' argument [-Wformat]
gutcheck.c: In function 'procfile':
gutcheck.c:957:21: warning: format not a string literal and no format arguments [-Wformat-security]
gutcheck.c:966:21: warning: format not a string literal and no format arguments [-Wformat-security]
gutcheck.c:976:17: warning: format not a string literal and no format arguments [-Wformat-security]
gutcheck.c:984:17: warning: format not a string literal and no format arguments [-Wformat-security]
gutcheck.c:992:17: warning: format not a string literal and no format arguments [-Wformat-security]
gutcheck.c:1000:17: warning: format not a string literal and no format arguments [-Wformat-security]
gutcheck.c:1174:21: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat]
gutcheck.c:1174:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat]
gutcheck.c:1207:25: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat]
gutcheck.c:1207:25: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat]
gutcheck.c:1491:21: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat]
gutcheck.c:2052:29: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat]

the one line 530 is a plain bug...the other are just warning... the one between 957 to 1000 can be abused to possibly break things badly using a carefully crafted input... the rest are just annoyance without practical real-world implication, still no warning is a good policy :-)

the attached patch get rid of these (licensed under the same term than gutcheck.c, i.e GPLv2+)

1 Attachments

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.