degesch: add static analysis for the logger
Caught two more occurences than I was able to find by just scanning the source, so the effort wasn't in vain.
This commit is contained in:
14
test-static
Executable file
14
test-static
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# We don't use printf's percent notation with our custom logging mechanism,
|
||||
# so the compiler cannot check it for us like it usually does
|
||||
perl -n0777 - "$(dirname "$0")"/degesch.c <<-'END'
|
||||
while (/\blog_[^ ]+\s*\([^"()]*"[^"]*%[^%][^"]*"/gm) {
|
||||
my ($p, $m) = ($`, $&);
|
||||
printf "$ARGV:%d: suspicious log format string: %s...\n",
|
||||
(1 + $p =~ tr/\n//), ($m =~ s/\s+/ /rg);
|
||||
$status = 1;
|
||||
}
|
||||
END {
|
||||
exit $status;
|
||||
}
|
||||
END
|
||||
Reference in New Issue
Block a user