From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id E9C993858D20; Fri, 28 Oct 2022 10:18:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9C993858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666952335; bh=NPQ0FuFkZb07l2UrQUaBATjtPwAN/vpjE0BSDBxciDI=; h=From:To:Subject:Date:From; b=jC0e5lGCXUG0tm0Nm3hzOwPW2VE/7pT1rjoY29n9SwqTiUaHgvsD95+86nId97MqA ud5HzgBqrEu7cSyUUnNlNx7Q3FKlkEOQLhCLZbWWRk9K7OeutMxrq6y23wiVzuM9QJ 7vlC/FYP0ye+6GFZP0DKy2iryzXwrHe/iR3gFwWA= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc] Fix missing NUL terminator in stdio-common/scanf13 test X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/master X-Git-Oldrev: 6a3794ea917558776ba1a66a925f2d5e1dbf0724 X-Git-Newrev: b866018f54ad0670ee9b930a14ae6e8960b9f4bf Message-Id: <20221028101855.E9C993858D20@sourceware.org> Date: Fri, 28 Oct 2022 10:18:53 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b866018f54ad0670ee9b930a14ae6e8960b9f4bf commit b866018f54ad0670ee9b930a14ae6e8960b9f4bf Author: Szabolcs Nagy Date: Tue Oct 11 14:57:16 2022 +0100 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: --- stdio-common/scanf13.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stdio-common/scanf13.c b/stdio-common/scanf13.c index 720224aa05..60aa62a26f 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