From: Szabolcs Nagy Date: Tue, 11 Oct 2022 13:57:16 +0000 (+0100) Subject: Fix missing NUL terminator in stdio-common/scanf13 test X-Git-Tag: glibc-2.37~207 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b866018f54ad0670ee9b930a14ae6e8960b9f4bf;p=thirdparty%2Fglibc.git Fix missing NUL terminator in stdio-common/scanf13 test sscanf is only defined on nul terminated string input, but '\0' was missing in this test which caused _IO_str_init_static_internal to read OOB on the stack when computing the bounds of the string. Reviewed-by: Florian Weimer --- diff --git a/stdio-common/scanf13.c b/stdio-common/scanf13.c index 720224aa05f..60aa62a26f1 100644 --- a/stdio-common/scanf13.c +++ b/stdio-common/scanf13.c @@ -67,6 +67,7 @@ main (void) buf[2049] = 0x84; buf[2058] = '\t'; buf[2059] = 'a'; + buf[sizeof (buf) - 1] = '\0'; if (sscanf (buf, "%ms%mc", &sp1, &sp2) != 2) FAIL (); else