Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9bc216 commit 2f290bdCopy full SHA for 2f290bd
1 file changed
cpp/ql/test/query-tests/Security/CWE/CWE-131/semmle/NoSpaceForZeroTerminator/test.cpp
@@ -107,3 +107,19 @@ void bad9(wchar_t *wstr) {
107
wcscpy(wbuffer, wstr);
108
delete wbuffer;
109
}
110
+
111
+void good3(char *str) {
112
+ // GOOD -- zero-termination not required for this printf
113
+ char *buffer = (char *)malloc(strlen(str));
114
+ decode(buffer, str);
115
+ wprintf(L"%p", buffer);
116
+ free(buffer);
117
+}
118
119
+void good4(char *str) {
120
121
122
123
+ wprintf(L"%.*s", strlen(str), buffer);
124
125
0 commit comments