diff options
author | Mike Kaufman <mike-kaufman@users.noreply.github.com> | 2017-08-21 16:30:34 -0700 |
---|---|---|
committer | Dan Moseley <danmose@microsoft.com> | 2017-08-21 16:30:34 -0700 |
commit | 358826b58e1863857d110b30abb32257171d1009 (patch) | |
tree | 496a41a80d6dfdd41ae864e700ca66f838501f08 /src/pal/tests/palsuite/c_runtime | |
parent | 41a2b788cb77668d397e372df40c5215bf61bfa7 (diff) | |
download | coreclr-358826b58e1863857d110b30abb32257171d1009.tar.gz coreclr-358826b58e1863857d110b30abb32257171d1009.tar.bz2 coreclr-358826b58e1863857d110b30abb32257171d1009.zip |
Fixing wcsstr function to account for cases where search string is longer than remaining target string. (#13504)
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime')
-rw-r--r-- | src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp index 8296a74983..16005a9f8e 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp @@ -21,6 +21,7 @@ int __cdecl main(int argc, char *argv[]) WCHAR *key1; WCHAR *key2; WCHAR key3[] = { 0 }; + WCHAR *key4; WCHAR *result; if (PAL_Initialize(argc, argv)) @@ -31,6 +32,7 @@ int __cdecl main(int argc, char *argv[]) string = convert("foo bar baz bar"); key1 = convert("bar"); key2 = convert("Bar"); + key4 = convert("arggggh!"); result = wcsstr(string, key1); if (result != string + 4) @@ -57,6 +59,14 @@ int __cdecl main(int argc, char *argv[]) convertC(key3), string, result); } + result = wcsstr(string, key4); + if (result != nullptr) + { + Fail("ERROR: Got incorrect result in scanning \"%s\" for \"%s\".\n" + "Expected to get pointer to null, got %#p\n", convertC(string), + convertC(key4), result); + } + PAL_Terminate(); return PASS; } |