Skip to contentSkip to conversation

+ vsprintf-ignore-arguments-to-%n.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Jan 28, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + vsprintf-ignore-arguments-to-%n.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 28 Jan 2014 12:05:40 -0800

The patch titled
Subject: vsprintf: ignore arguments to %n
has been added to the -mm tree. Its filename is
vsprintf-ignore-arguments-to-%n.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/vsprintf-ignore-arguments-to-%n.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/vsprintf-ignore-arguments-to-%n.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Kees Cook <[email protected]>
Subject: vsprintf: ignore arguments to %n

If arguments are consumed without output when encountering %n, it could be used to benefit or improve information leak attacks that were exposed via a limited size buffer. Since %n is not used by the kernel, there is no reason to make an info leak attack any easier.

Cc Ryan Mallon <[email protected]>
Cc Jiri Kosina <[email protected]>
Cc Joe Perches <[email protected]>
Cc Al Viro <[email protected]>
Cc Olof Johansson <[email protected]>
Cc Stepan Moskovchenko <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc <[email protected]> [3.13+]

---

 lib/vsprintf.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
lib/vsprintf.c renamed from lib/vsprintf.c~vsprintf-ignore-arguments-to-%n +2 -5
diff -puN lib/vsprintf.c~vsprintf-ignore-arguments-to-%n lib/vsprintf.c
@@ -1735,14 +1735,10 @@ int vsnprintf(char *buf, size_t size, co
 		case FORMAT_TYPE_NRCHARS: {
 			/*
 			 * Since %n poses a greater security risk than
-			 * utility, ignore %n and skip its argument.
+			 * utility, it should not be implemented. Instead,
+			 * when encountering %n, ignore the arguments.
 			 */
-			void *skip_arg;
-
-			WARN_ONCE(1, "Please remove ignored %%n in '%s'\n",
-					old_fmt);