Compare commits

..

No commits in common. "4bb9449e47a24e6bd0944304d83e18927f76a220" and "3f9a365d366e8fed4f2d02bbb6f1a4e117593431" have entirely different histories.

2 changed files with 3 additions and 11 deletions

View File

@ -1,16 +1,8 @@
#!/bin/sh #!/bin/sh
# We don't use printf's percent notation with our custom logging mechanism, # 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. # so the compiler cannot check it for us like it usually does
#
# In clang-query terms, the string we're interested in can be found through:
# set traversal IgnoreUnlessSpelledInSource
# set output dump
# match callExpr(callee(functionDecl(
# hasName("log_full"))),
# hasArgument(5, stringLiteral().bind("format")))
# However, the tool is too restricted to be useful in a shell script.
perl -n0777 - "$(dirname "$0")"/xC.c <<-'END' perl -n0777 - "$(dirname "$0")"/xC.c <<-'END'
while (/\blog_[^ ]+\s*\([^"()]*"[^"]*%\w[^"]*"/gm) { while (/\blog_[^ ]+\s*\([^"()]*"[^"]*%[^%][^"]*"/gm) {
my ($p, $m) = ($`, $&); my ($p, $m) = ($`, $&);
printf "$ARGV:%d: suspicious log format string: %s...\n", printf "$ARGV:%d: suspicious log format string: %s...\n",
(1 + $p =~ tr/\n//), ($m =~ s/\s+/ /rg); (1 + $p =~ tr/\n//), ($m =~ s/\s+/ /rg);

2
xC.c
View File

@ -15470,7 +15470,7 @@ client_message_buffer_name (const struct relay_command_message *m)
switch (m->data.command) switch (m->data.command)
{ {
case RELAY_COMMAND_BUFFER_COMPLETE: case RELAY_COMMAND_BUFFER_COMPLETE:
return m->data.buffer_complete.buffer_name.str; return m->data.buffer_input.buffer_name.str;
case RELAY_COMMAND_BUFFER_ACTIVATE: case RELAY_COMMAND_BUFFER_ACTIVATE:
return m->data.buffer_activate.buffer_name.str; return m->data.buffer_activate.buffer_name.str;
case RELAY_COMMAND_BUFFER_INPUT: case RELAY_COMMAND_BUFFER_INPUT: