You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm currently trying to use the static analysis tool Infer to find uncatched API-misuse bugs in OpenWrt packages, and I find a potential Format String bug in your project, version 1.19.
The bug located in smtp.c. Firstly, the program read bytes from fp to buf using fread() in line 638, and buf is later used as the parameter of showVerbose() in line 650, as shown in the following code:
while (fgets(buf,bufsz,fp))
{
write_to_socket(buf);
if (g_show_attachment_in_log)
{
showVerbose("[C] %s",buf);
}
}
(void) fclose(fp);
(void) snprintf(buf,bufsz,"\r\n\r\n");
msock_puts(buf);
showVerbose(buf);
Inside showVerbose(), it directly calls vprintf() twice time with the controlled buffer, which violates CWE134 and can cause undefined behavior.
I also attached the analysis trace given by Infer FYI:
Fortunately format string is not externally controlled, but should be fixed. Could you test the following code and tell me the infer command you used? It should have the same issue. I could not reproduce it on Ubuntu 20.0.4
File: test.c
infer --version
Infer version v1.1.0
Copyright 2009 - present Facebook. All Rights Reserved.
infer run -- gcc -g -Wall test.c
Capturing in make/cc mode...
Found 1 source file to analyze in /home/muquit/junk/infer-out
1/1 [################################################################################] 100% 56.294ms
No issues found
Actually I'm using a signature-based vulnerability detection tool called Tracer which is built upon Infer. And I don't find that bug with Infer either.
Hi, I'm currently trying to use the static analysis tool Infer to find uncatched API-misuse bugs in OpenWrt packages, and I find a potential Format String bug in your project, version 1.19.
The bug located in smtp.c. Firstly, the program read bytes from
fp
tobuf
usingfread()
in line 638, andbuf
is later used as the parameter ofshowVerbose()
in line 650, as shown in the following code:Inside
showVerbose()
, it directly callsvprintf()
twice time with the controlled buffer, which violates CWE134 and can cause undefined behavior.I also attached the analysis trace given by Infer FYI:
The text was updated successfully, but these errors were encountered: