summaryrefslogtreecommitdiff
path: root/Tests/LibC
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2022-02-14 16:52:14 +1100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-02-20 00:13:08 +0330
commit5b32b46ebc4b1bc3084380d047e5197cef4e2b79 (patch)
treedfff7da4a3ff144ef9c9162e2a0d3ae307882565 /Tests/LibC
parent31079a56d762ea9421a5d842eb5d86227f3072a5 (diff)
downloadserenity-5b32b46ebc4b1bc3084380d047e5197cef4e2b79.zip
LibC: Do not write value when scanf assignment value is suppressed
This change has the positive side-effect of causing scanf to *segfault* when a NULL pointer argument is passed to scanf. e.g. sscanf(str, "%d", NULL);
Diffstat (limited to 'Tests/LibC')
-rw-r--r--Tests/LibC/TestScanf.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Tests/LibC/TestScanf.cpp b/Tests/LibC/TestScanf.cpp
index 8efca5350c..5209088400 100644
--- a/Tests/LibC/TestScanf.cpp
+++ b/Tests/LibC/TestScanf.cpp
@@ -179,6 +179,7 @@ const TestSuite test_suites[] {
{ "%n", "", 0, 1, { intarg0 }, { to_value_t(0) } },
{ "%d %n", "1 a", 1, 2, { intarg0, intarg1 }, { to_value_t(1), to_value_t(2) } },
{ "%*d", " 42", 0, 0, {}, {} },
+ { "%d%*1[:/]%d", "24/7", 2, 2, { intarg0, intarg1 }, { to_value_t(24), to_value_t(7) } },
};
bool g_any_failed = false;