1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

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);
This commit is contained in:
Peter Ross 2022-02-14 16:52:14 +11:00 committed by Ali Mohammad Pur
parent 31079a56d7
commit 5b32b46ebc
2 changed files with 60 additions and 53 deletions

View file

@ -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;