Skip to content

Commit e29efc7

Browse files
committed
C++: Add tests with missing flow.
1 parent cafb73a commit e29efc7

4 files changed

Lines changed: 429 additions & 0 deletions

File tree

cpp/ql/test/library-tests/dataflow/source-sink-tests/sources-and-sinks.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,19 @@ void test_zmc(void *socket) {
115115
// ...
116116
}
117117
}
118+
119+
long StringCchGetsA(char *, size_t);
120+
long StringCchGetsExA(char *, size_t, char **, size_t *, unsigned long);
121+
122+
void test_strsafe_gets() {
123+
{
124+
char dest[256] = {0};
125+
StringCchGetsA(dest, sizeof(dest)); // $ MISSING: local_source
126+
}
127+
{
128+
char dest[256] = {0};
129+
char *end;
130+
size_t remaining;
131+
StringCchGetsExA(dest, sizeof(dest), &end, &remaining, 0); // $ MISSING: local_source
132+
}
133+
}

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

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8008,6 +8008,174 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
80088008
| taint.cpp:866:26:866:34 | ref arg & ... | taint.cpp:866:27:866:34 | size_out [inner post update] | |
80098009
| taint.cpp:866:27:866:34 | size_out | taint.cpp:866:26:866:34 | & ... | |
80108010
| taint.cpp:867:8:867:8 | p | taint.cpp:867:7:867:8 | * ... | TAINT |
8011+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:897:38:897:43 | source | |
8012+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:907:37:907:42 | source | |
8013+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:914:40:914:45 | source | |
8014+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:919:39:919:44 | source | |
8015+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:926:41:926:46 | source | |
8016+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:931:37:931:42 | source | |
8017+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:941:36:941:41 | source | |
8018+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:948:39:948:44 | source | |
8019+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:953:38:953:43 | source | |
8020+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:960:40:960:45 | source | |
8021+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:965:46:965:51 | source | |
8022+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:975:45:975:50 | source | |
8023+
| taint.cpp:892:17:892:31 | call to indirect_source | taint.cpp:982:69:982:74 | source | |
8024+
| taint.cpp:893:32:893:46 | call to indirect_source | taint.cpp:902:38:902:44 | wsource | |
8025+
| taint.cpp:893:32:893:46 | call to indirect_source | taint.cpp:936:37:936:43 | wsource | |
8026+
| taint.cpp:893:32:893:46 | call to indirect_source | taint.cpp:970:47:970:53 | wsource | |
8027+
| taint.cpp:896:19:896:22 | {...} | taint.cpp:897:18:897:21 | dest | |
8028+
| taint.cpp:896:19:896:22 | {...} | taint.cpp:897:31:897:34 | dest | |
8029+
| taint.cpp:896:19:896:22 | {...} | taint.cpp:898:9:898:12 | dest | |
8030+
| taint.cpp:896:21:896:21 | 0 | taint.cpp:896:19:896:22 | {...} | TAINT |
8031+
| taint.cpp:897:18:897:21 | ref arg dest | taint.cpp:898:9:898:12 | dest | |
8032+
| taint.cpp:898:9:898:12 | dest | taint.cpp:898:8:898:12 | * ... | |
8033+
| taint.cpp:901:22:901:25 | {...} | taint.cpp:902:18:902:21 | dest | |
8034+
| taint.cpp:901:22:901:25 | {...} | taint.cpp:902:31:902:34 | dest | |
8035+
| taint.cpp:901:22:901:25 | {...} | taint.cpp:903:9:903:12 | dest | |
8036+
| taint.cpp:901:24:901:24 | 0 | taint.cpp:901:22:901:25 | {...} | TAINT |
8037+
| taint.cpp:902:18:902:21 | ref arg dest | taint.cpp:903:9:903:12 | dest | |
8038+
| taint.cpp:903:9:903:12 | dest | taint.cpp:903:8:903:12 | * ... | |
8039+
| taint.cpp:906:19:906:22 | {...} | taint.cpp:907:17:907:20 | dest | |
8040+
| taint.cpp:906:19:906:22 | {...} | taint.cpp:907:30:907:33 | dest | |
8041+
| taint.cpp:906:19:906:22 | {...} | taint.cpp:908:9:908:12 | dest | |
8042+
| taint.cpp:906:21:906:21 | 0 | taint.cpp:906:19:906:22 | {...} | TAINT |
8043+
| taint.cpp:907:17:907:20 | ref arg dest | taint.cpp:908:9:908:12 | dest | |
8044+
| taint.cpp:908:9:908:12 | dest | taint.cpp:908:8:908:12 | * ... | |
8045+
| taint.cpp:911:19:911:22 | {...} | taint.cpp:914:20:914:23 | dest | |
8046+
| taint.cpp:911:19:911:22 | {...} | taint.cpp:914:33:914:36 | dest | |
8047+
| taint.cpp:911:19:911:22 | {...} | taint.cpp:915:9:915:12 | dest | |
8048+
| taint.cpp:911:21:911:21 | 0 | taint.cpp:911:19:911:22 | {...} | TAINT |
8049+
| taint.cpp:912:9:912:11 | end | taint.cpp:914:49:914:51 | end | |
8050+
| taint.cpp:913:10:913:18 | remaining | taint.cpp:914:55:914:63 | remaining | |
8051+
| taint.cpp:914:20:914:23 | ref arg dest | taint.cpp:915:9:915:12 | dest | |
8052+
| taint.cpp:914:48:914:51 | ref arg & ... | taint.cpp:914:49:914:51 | end [inner post update] | |
8053+
| taint.cpp:914:49:914:51 | end | taint.cpp:914:48:914:51 | & ... | |
8054+
| taint.cpp:914:54:914:63 | ref arg & ... | taint.cpp:914:55:914:63 | remaining [inner post update] | |
8055+
| taint.cpp:914:55:914:63 | remaining | taint.cpp:914:54:914:63 | & ... | |
8056+
| taint.cpp:915:9:915:12 | dest | taint.cpp:915:8:915:12 | * ... | |
8057+
| taint.cpp:918:19:918:22 | {...} | taint.cpp:919:19:919:22 | dest | |
8058+
| taint.cpp:918:19:918:22 | {...} | taint.cpp:919:32:919:35 | dest | |
8059+
| taint.cpp:918:19:918:22 | {...} | taint.cpp:920:9:920:12 | dest | |
8060+
| taint.cpp:918:21:918:21 | 0 | taint.cpp:918:19:918:22 | {...} | TAINT |
8061+
| taint.cpp:919:19:919:22 | ref arg dest | taint.cpp:920:9:920:12 | dest | |
8062+
| taint.cpp:920:9:920:12 | dest | taint.cpp:920:8:920:12 | * ... | |
8063+
| taint.cpp:923:19:923:22 | {...} | taint.cpp:926:21:926:24 | dest | |
8064+
| taint.cpp:923:19:923:22 | {...} | taint.cpp:926:34:926:37 | dest | |
8065+
| taint.cpp:923:19:923:22 | {...} | taint.cpp:927:8:927:11 | dest | |
8066+
| taint.cpp:923:21:923:21 | 0 | taint.cpp:923:19:923:22 | {...} | TAINT |
8067+
| taint.cpp:924:9:924:11 | end | taint.cpp:926:55:926:57 | end | |
8068+
| taint.cpp:925:10:925:18 | remaining | taint.cpp:926:61:926:69 | remaining | |
8069+
| taint.cpp:926:21:926:24 | ref arg dest | taint.cpp:927:8:927:11 | dest | |
8070+
| taint.cpp:926:54:926:57 | ref arg & ... | taint.cpp:926:55:926:57 | end [inner post update] | |
8071+
| taint.cpp:926:55:926:57 | end | taint.cpp:926:54:926:57 | & ... | |
8072+
| taint.cpp:926:60:926:69 | ref arg & ... | taint.cpp:926:61:926:69 | remaining [inner post update] | |
8073+
| taint.cpp:926:61:926:69 | remaining | taint.cpp:926:60:926:69 | & ... | |
8074+
| taint.cpp:930:20:930:27 | prefix | taint.cpp:931:17:931:20 | dest | |
8075+
| taint.cpp:930:20:930:27 | prefix | taint.cpp:931:30:931:33 | dest | |
8076+
| taint.cpp:930:20:930:27 | prefix | taint.cpp:932:9:932:12 | dest | |
8077+
| taint.cpp:931:17:931:20 | ref arg dest | taint.cpp:932:9:932:12 | dest | |
8078+
| taint.cpp:932:9:932:12 | dest | taint.cpp:932:8:932:12 | * ... | |
8079+
| taint.cpp:935:23:935:31 | prefix | taint.cpp:936:17:936:20 | dest | |
8080+
| taint.cpp:935:23:935:31 | prefix | taint.cpp:936:30:936:33 | dest | |
8081+
| taint.cpp:935:23:935:31 | prefix | taint.cpp:937:9:937:12 | dest | |
8082+
| taint.cpp:936:17:936:20 | ref arg dest | taint.cpp:937:9:937:12 | dest | |
8083+
| taint.cpp:937:9:937:12 | dest | taint.cpp:937:8:937:12 | * ... | |
8084+
| taint.cpp:940:20:940:27 | prefix | taint.cpp:941:16:941:19 | dest | |
8085+
| taint.cpp:940:20:940:27 | prefix | taint.cpp:941:29:941:32 | dest | |
8086+
| taint.cpp:940:20:940:27 | prefix | taint.cpp:942:9:942:12 | dest | |
8087+
| taint.cpp:941:16:941:19 | ref arg dest | taint.cpp:942:9:942:12 | dest | |
8088+
| taint.cpp:942:9:942:12 | dest | taint.cpp:942:8:942:12 | * ... | |
8089+
| taint.cpp:945:20:945:27 | prefix | taint.cpp:948:19:948:22 | dest | |
8090+
| taint.cpp:945:20:945:27 | prefix | taint.cpp:948:32:948:35 | dest | |
8091+
| taint.cpp:945:20:945:27 | prefix | taint.cpp:949:9:949:12 | dest | |
8092+
| taint.cpp:946:9:946:11 | end | taint.cpp:948:48:948:50 | end | |
8093+
| taint.cpp:947:10:947:18 | remaining | taint.cpp:948:54:948:62 | remaining | |
8094+
| taint.cpp:948:19:948:22 | ref arg dest | taint.cpp:949:9:949:12 | dest | |
8095+
| taint.cpp:948:47:948:50 | ref arg & ... | taint.cpp:948:48:948:50 | end [inner post update] | |
8096+
| taint.cpp:948:48:948:50 | end | taint.cpp:948:47:948:50 | & ... | |
8097+
| taint.cpp:948:53:948:62 | ref arg & ... | taint.cpp:948:54:948:62 | remaining [inner post update] | |
8098+
| taint.cpp:948:54:948:62 | remaining | taint.cpp:948:53:948:62 | & ... | |
8099+
| taint.cpp:949:9:949:12 | dest | taint.cpp:949:8:949:12 | * ... | |
8100+
| taint.cpp:952:20:952:27 | prefix | taint.cpp:953:18:953:21 | dest | |
8101+
| taint.cpp:952:20:952:27 | prefix | taint.cpp:953:31:953:34 | dest | |
8102+
| taint.cpp:952:20:952:27 | prefix | taint.cpp:954:9:954:12 | dest | |
8103+
| taint.cpp:953:18:953:21 | ref arg dest | taint.cpp:954:9:954:12 | dest | |
8104+
| taint.cpp:954:9:954:12 | dest | taint.cpp:954:8:954:12 | * ... | |
8105+
| taint.cpp:957:20:957:27 | prefix | taint.cpp:960:20:960:23 | dest | |
8106+
| taint.cpp:957:20:957:27 | prefix | taint.cpp:960:33:960:36 | dest | |
8107+
| taint.cpp:957:20:957:27 | prefix | taint.cpp:961:9:961:12 | dest | |
8108+
| taint.cpp:958:9:958:11 | end | taint.cpp:960:54:960:56 | end | |
8109+
| taint.cpp:959:10:959:18 | remaining | taint.cpp:960:60:960:68 | remaining | |
8110+
| taint.cpp:960:20:960:23 | ref arg dest | taint.cpp:961:9:961:12 | dest | |
8111+
| taint.cpp:960:53:960:56 | ref arg & ... | taint.cpp:960:54:960:56 | end [inner post update] | |
8112+
| taint.cpp:960:54:960:56 | end | taint.cpp:960:53:960:56 | & ... | |
8113+
| taint.cpp:960:59:960:68 | ref arg & ... | taint.cpp:960:60:960:68 | remaining [inner post update] | |
8114+
| taint.cpp:960:60:960:68 | remaining | taint.cpp:960:59:960:68 | & ... | |
8115+
| taint.cpp:961:9:961:12 | dest | taint.cpp:961:8:961:12 | * ... | |
8116+
| taint.cpp:964:19:964:22 | {...} | taint.cpp:965:20:965:23 | dest | |
8117+
| taint.cpp:964:19:964:22 | {...} | taint.cpp:965:33:965:36 | dest | |
8118+
| taint.cpp:964:19:964:22 | {...} | taint.cpp:966:9:966:12 | dest | |
8119+
| taint.cpp:964:21:964:21 | 0 | taint.cpp:964:19:964:22 | {...} | TAINT |
8120+
| taint.cpp:965:20:965:23 | ref arg dest | taint.cpp:966:9:966:12 | dest | |
8121+
| taint.cpp:965:40:965:43 | %s | taint.cpp:965:20:965:23 | ref arg dest | TAINT |
8122+
| taint.cpp:965:46:965:51 | ref arg source | taint.cpp:975:45:975:50 | source | |
8123+
| taint.cpp:965:46:965:51 | ref arg source | taint.cpp:982:69:982:74 | source | |
8124+
| taint.cpp:965:46:965:51 | source | taint.cpp:965:20:965:23 | ref arg dest | TAINT |
8125+
| taint.cpp:966:9:966:12 | dest | taint.cpp:966:8:966:12 | * ... | |
8126+
| taint.cpp:969:22:969:25 | {...} | taint.cpp:970:20:970:23 | dest | |
8127+
| taint.cpp:969:22:969:25 | {...} | taint.cpp:970:33:970:36 | dest | |
8128+
| taint.cpp:969:22:969:25 | {...} | taint.cpp:971:9:971:12 | dest | |
8129+
| taint.cpp:969:24:969:24 | 0 | taint.cpp:969:22:969:25 | {...} | TAINT |
8130+
| taint.cpp:970:20:970:23 | ref arg dest | taint.cpp:971:9:971:12 | dest | |
8131+
| taint.cpp:970:40:970:44 | %s | taint.cpp:970:20:970:23 | ref arg dest | TAINT |
8132+
| taint.cpp:970:47:970:53 | wsource | taint.cpp:970:20:970:23 | ref arg dest | TAINT |
8133+
| taint.cpp:971:9:971:12 | dest | taint.cpp:971:8:971:12 | * ... | |
8134+
| taint.cpp:974:19:974:22 | {...} | taint.cpp:975:19:975:22 | dest | |
8135+
| taint.cpp:974:19:974:22 | {...} | taint.cpp:975:32:975:35 | dest | |
8136+
| taint.cpp:974:19:974:22 | {...} | taint.cpp:976:9:976:12 | dest | |
8137+
| taint.cpp:974:21:974:21 | 0 | taint.cpp:974:19:974:22 | {...} | TAINT |
8138+
| taint.cpp:975:19:975:22 | ref arg dest | taint.cpp:976:9:976:12 | dest | |
8139+
| taint.cpp:975:39:975:42 | %s | taint.cpp:975:19:975:22 | ref arg dest | TAINT |
8140+
| taint.cpp:975:45:975:50 | ref arg source | taint.cpp:982:69:982:74 | source | |
8141+
| taint.cpp:975:45:975:50 | source | taint.cpp:975:19:975:22 | ref arg dest | TAINT |
8142+
| taint.cpp:976:9:976:12 | dest | taint.cpp:976:8:976:12 | * ... | |
8143+
| taint.cpp:979:19:979:22 | {...} | taint.cpp:982:22:982:25 | dest | |
8144+
| taint.cpp:979:19:979:22 | {...} | taint.cpp:982:35:982:38 | dest | |
8145+
| taint.cpp:979:19:979:22 | {...} | taint.cpp:983:9:983:12 | dest | |
8146+
| taint.cpp:979:21:979:21 | 0 | taint.cpp:979:19:979:22 | {...} | TAINT |
8147+
| taint.cpp:980:9:980:11 | end | taint.cpp:982:43:982:45 | end | |
8148+
| taint.cpp:981:10:981:18 | remaining | taint.cpp:982:49:982:57 | remaining | |
8149+
| taint.cpp:982:22:982:25 | ref arg dest | taint.cpp:983:9:983:12 | dest | |
8150+
| taint.cpp:982:42:982:45 | ref arg & ... | taint.cpp:982:43:982:45 | end [inner post update] | |
8151+
| taint.cpp:982:43:982:45 | end | taint.cpp:982:42:982:45 | & ... | |
8152+
| taint.cpp:982:48:982:57 | ref arg & ... | taint.cpp:982:49:982:57 | remaining [inner post update] | |
8153+
| taint.cpp:982:49:982:57 | remaining | taint.cpp:982:48:982:57 | & ... | |
8154+
| taint.cpp:982:63:982:66 | %s | taint.cpp:982:22:982:25 | ref arg dest | TAINT |
8155+
| taint.cpp:982:69:982:74 | source | taint.cpp:982:22:982:25 | ref arg dest | TAINT |
8156+
| taint.cpp:983:9:983:12 | dest | taint.cpp:983:8:983:12 | * ... | |
8157+
| taint.cpp:986:19:986:22 | {...} | taint.cpp:988:20:988:23 | dest | |
8158+
| taint.cpp:986:19:986:22 | {...} | taint.cpp:988:33:988:36 | dest | |
8159+
| taint.cpp:986:19:986:22 | {...} | taint.cpp:989:9:989:12 | dest | |
8160+
| taint.cpp:986:21:986:21 | 0 | taint.cpp:986:19:986:22 | {...} | TAINT |
8161+
| taint.cpp:987:15:987:29 | call to indirect_source | taint.cpp:988:40:988:42 | fmt | |
8162+
| taint.cpp:988:20:988:23 | ref arg dest | taint.cpp:989:9:989:12 | dest | |
8163+
| taint.cpp:988:40:988:42 | fmt | taint.cpp:988:20:988:23 | ref arg dest | TAINT |
8164+
| taint.cpp:989:9:989:12 | dest | taint.cpp:989:8:989:12 | * ... | |
8165+
| taint.cpp:992:19:992:22 | {...} | taint.cpp:993:20:993:23 | dest | |
8166+
| taint.cpp:992:19:992:22 | {...} | taint.cpp:993:33:993:36 | dest | |
8167+
| taint.cpp:992:19:992:22 | {...} | taint.cpp:994:9:994:12 | dest | |
8168+
| taint.cpp:992:21:992:21 | 0 | taint.cpp:992:19:992:22 | {...} | TAINT |
8169+
| taint.cpp:993:20:993:23 | ref arg dest | taint.cpp:994:9:994:12 | dest | |
8170+
| taint.cpp:993:40:993:43 | %d | taint.cpp:993:20:993:23 | ref arg dest | TAINT |
8171+
| taint.cpp:993:46:993:47 | 42 | taint.cpp:993:20:993:23 | ref arg dest | TAINT |
8172+
| taint.cpp:994:9:994:12 | dest | taint.cpp:994:8:994:12 | * ... | |
8173+
| taint.cpp:997:19:997:22 | {...} | taint.cpp:998:18:998:21 | dest | |
8174+
| taint.cpp:997:19:997:22 | {...} | taint.cpp:998:31:998:34 | dest | |
8175+
| taint.cpp:997:19:997:22 | {...} | taint.cpp:999:9:999:12 | dest | |
8176+
| taint.cpp:997:21:997:21 | 0 | taint.cpp:997:19:997:22 | {...} | TAINT |
8177+
| taint.cpp:998:18:998:21 | ref arg dest | taint.cpp:999:9:999:12 | dest | |
8178+
| taint.cpp:999:9:999:12 | dest | taint.cpp:999:8:999:12 | * ... | |
80118179
| thread.cpp:10:27:10:27 | s | thread.cpp:10:27:10:27 | s | |
80128180
| thread.cpp:10:27:10:27 | s | thread.cpp:11:8:11:8 | s | |
80138181
| thread.cpp:14:26:14:26 | s | thread.cpp:15:8:15:8 | s | |

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

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,3 +866,136 @@ void test_iconv(size_t size) {
866866
iconv(0, &s, &size, &p, &size_out);
867867
sink(*p); // $ ast,ir
868868
}
869+
870+
using va_list = void*;
871+
872+
long StringCchCopyA(char *, size_t, const char *);
873+
long StringCchCopyW(wchar_t *, size_t, const wchar_t *);
874+
long StringCbCopyA(char *, size_t, const char *);
875+
long StringCchCopyExA(char *, size_t, const char *, char **, size_t *, unsigned long);
876+
long StringCchCopyNA(char *, size_t, const char *, size_t);
877+
long StringCchCopyNExA(char *, size_t, const char *, size_t, char **, size_t *, unsigned long);
878+
long StringCchCatA(char *, size_t, const char *);
879+
long StringCchCatW(wchar_t *, size_t, const wchar_t *);
880+
long StringCbCatA(char *, size_t, const char *);
881+
long StringCchCatExA(char *, size_t, const char *, char **, size_t *, unsigned long);
882+
long StringCchCatNA(char *, size_t, const char *, size_t);
883+
long StringCchCatNExA(char *, size_t, const char *, size_t, char **, size_t *, unsigned long);
884+
long StringCchPrintfA(char *, size_t, const char *, ...);
885+
long StringCchPrintfW(wchar_t *, size_t, const wchar_t *, ...);
886+
long StringCbPrintfA(char *, size_t, const char *, ...);
887+
long StringCchPrintfExA(char *, size_t, char **, size_t *, unsigned long, const char *, ...);
888+
long StringCchVPrintfA(char *, size_t, const char *, va_list);
889+
long StringCchVPrintfExA(char *, size_t, char **, size_t *, unsigned long, const char *, va_list);
890+
891+
void test_strsafe() {
892+
char *source = indirect_source();
893+
wchar_t *wsource = (wchar_t *)indirect_source();
894+
895+
{
896+
char dest[256] = {0};
897+
StringCchCopyA(dest, sizeof(dest), source);
898+
sink(*dest); // $ MISSING: ir,ast
899+
}
900+
{
901+
wchar_t dest[256] = {0};
902+
StringCchCopyW(dest, sizeof(dest), wsource);
903+
sink(*dest); // $ MISSING: ir,ast
904+
}
905+
{
906+
char dest[256] = {0};
907+
StringCbCopyA(dest, sizeof(dest), source);
908+
sink(*dest); // $ MISSING: ir,ast
909+
}
910+
{
911+
char dest[256] = {0};
912+
char *end;
913+
size_t remaining;
914+
StringCchCopyExA(dest, sizeof(dest), source, &end, &remaining, 0);
915+
sink(*dest); // $ MISSING: ir,ast
916+
}
917+
{
918+
char dest[256] = {0};
919+
StringCchCopyNA(dest, sizeof(dest), source, 128);
920+
sink(*dest); // $ MISSING: ir,ast
921+
}
922+
{
923+
char dest[256] = {0};
924+
char *end;
925+
size_t remaining;
926+
StringCchCopyNExA(dest, sizeof(dest), source, 128, &end, &remaining, 0);
927+
sink(dest); // $ MISSING: ir,ast
928+
}
929+
{
930+
char dest[256] = "prefix";
931+
StringCchCatA(dest, sizeof(dest), source);
932+
sink(*dest); // $ MISSING: ir,ast
933+
}
934+
{
935+
wchar_t dest[256] = L"prefix";
936+
StringCchCatW(dest, sizeof(dest), wsource);
937+
sink(*dest); // $ MISSING: ir,ast
938+
}
939+
{
940+
char dest[256] = "prefix";
941+
StringCbCatA(dest, sizeof(dest), source);
942+
sink(*dest); // $ MISSING: ir,ast
943+
}
944+
{
945+
char dest[256] = "prefix";
946+
char *end;
947+
size_t remaining;
948+
StringCchCatExA(dest, sizeof(dest), source, &end, &remaining, 0);
949+
sink(*dest); // $ MISSING: ir,ast
950+
}
951+
{
952+
char dest[256] = "prefix";
953+
StringCchCatNA(dest, sizeof(dest), source, 128);
954+
sink(*dest); // $ MISSING: ir,ast
955+
}
956+
{
957+
char dest[256] = "prefix";
958+
char *end;
959+
size_t remaining;
960+
StringCchCatNExA(dest, sizeof(dest), source, 128, &end, &remaining, 0);
961+
sink(*dest); // $ MISSING: ir,ast
962+
}
963+
{
964+
char dest[256] = {0};
965+
StringCchPrintfA(dest, sizeof(dest), "%s", source);
966+
sink(*dest); // $ MISSING: ir,ast
967+
}
968+
{
969+
wchar_t dest[256] = {0};
970+
StringCchPrintfW(dest, sizeof(dest), L"%s", wsource);
971+
sink(*dest); // $ MISSING: ir,ast
972+
}
973+
{
974+
char dest[256] = {0};
975+
StringCbPrintfA(dest, sizeof(dest), "%s", source);
976+
sink(*dest); // $ MISSING: ir,ast
977+
}
978+
{
979+
char dest[256] = {0};
980+
char *end;
981+
size_t remaining;
982+
StringCchPrintfExA(dest, sizeof(dest), &end, &remaining, 0, "%s", source);
983+
sink(*dest); // $ MISSING: ir,ast
984+
}
985+
{
986+
char dest[256] = {0};
987+
char *fmt = indirect_source();
988+
StringCchPrintfA(dest, sizeof(dest), fmt);
989+
sink(*dest); // $ MISSING: ir,ast
990+
}
991+
{
992+
char dest[256] = {0};
993+
StringCchPrintfA(dest, sizeof(dest), "%d", 42);
994+
sink(*dest); // clean
995+
}
996+
{
997+
char dest[256] = {0};
998+
StringCchCopyA(dest, sizeof(dest), "hello");
999+
sink(*dest); // clean
1000+
}
1001+
}

0 commit comments

Comments
 (0)