Skip to content

Commit 95537ed

Browse files
committed
C++: Fix mysprintf in test.
1 parent d96bf79 commit 95537ed

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cpp/ql/test/library-tests/dataflow/taint-tests/format.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ int vsnprintf(char *s, size_t n, const char *format, va_list arg);
1515

1616
int mysprintf(char *s, size_t n, const char *format, ...)
1717
{
18-
18+
int result;
1919

2020
va_list args;
2121
va_start(args, format);
22-
vsnprintf(s, n, format, args);
22+
result = vsnprintf(s, n, format, args);
2323
va_end(args);
2424

25-
25+
return result;
2626
}
2727

2828
int sscanf(const char *s, const char *format, ...);

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
| file://:0:0:0:0 | p#0 | file://:0:0:0:0 | p#0 | |
44
| file://:0:0:0:0 | p#0 | file://:0:0:0:0 | p#0 | |
55
| file://:0:0:0:0 | p#0 | file://:0:0:0:0 | p#0 | |
6-
| format.cpp:16:21:16:21 | s | format.cpp:22:13:22:13 | s | |
7-
| format.cpp:16:31:16:31 | n | format.cpp:22:16:22:16 | n | |
8-
| format.cpp:16:46:16:51 | format | format.cpp:22:19:22:24 | format | |
9-
| format.cpp:20:10:20:13 | args | format.cpp:22:27:22:30 | args | |
6+
| format.cpp:16:21:16:21 | s | format.cpp:22:22:22:22 | s | |
7+
| format.cpp:16:31:16:31 | n | format.cpp:22:25:22:25 | n | |
8+
| format.cpp:16:46:16:51 | format | format.cpp:22:28:22:33 | format | |
9+
| format.cpp:20:10:20:13 | args | format.cpp:22:36:22:39 | args | |
10+
| format.cpp:22:12:22:20 | call to vsnprintf | format.cpp:22:3:22:40 | ... = ... | |
11+
| format.cpp:22:12:22:20 | call to vsnprintf | format.cpp:25:9:25:14 | result | |
1012
| format.cpp:50:21:50:24 | {...} | format.cpp:51:17:51:22 | buffer | |
1113
| format.cpp:50:21:50:24 | {...} | format.cpp:52:8:52:13 | buffer | |
1214
| format.cpp:50:23:50:23 | 0 | format.cpp:50:21:50:24 | {...} | TAINT |

0 commit comments

Comments
 (0)