From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [RFC PATCH] vsnprintf: Remove use of %n and convert existing uses Date: Wed, 11 Sep 2013 16:43:03 -0700 Message-ID: <1378942983.4714.40.camel@joe-AO722> References: <20130911044116.GA17294@www.outflux.net> <1378875632.606.5.camel@joe-AO722> <20130911093118.GD25896@mwanda> <1378926562.4714.11.camel@joe-AO722> <1378928700.4714.17.camel@joe-AO722> <1378941761.4714.37.camel@joe-AO722> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: LKML , KOSAKI Motohiro , Frederic Weisbecker , Dan Carpenter , devel@driverdev.osuosl.org, Greg Kroah-Hartman , Tushar Behera , Lidza Louina , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , Remi Denis-Courmont , Vlad Yasevich , Neil Horman , netdev@vger.kernel.org, linux-sctp@vger.kernel.org To: Kees Cook Return-path: Received: from smtprelay0129.hostedemail.com ([216.40.44.129]:41395 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753597Ab3IKXnN (ORCPT ); Wed, 11 Sep 2013 19:43:13 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 2013-09-11 at 16:29 -0700, Kees Cook wrote: > On Wed, Sep 11, 2013 at 4:22 PM, Joe Perches wrote: > > Using vsnprintf or its derivatives with %n can have security > > vulnerability implications. > > > > Prior to commit fef20d9c1380 > > ("vsprintf: unify the format decoding layer for its 3 users"), > > any use of %n was ignored. > > > > Reintroduce this feature and convert the existing uses of %n > > to use the return length from vsnprintf or its derivatives. > > > > Signed-off-by: Joe Perches > > Acked-by: KOSAKI Motohiro (proc bits) > > cc: Kees Cook > > cc: Frederic Weisbecker > > Yes, please. It might also be worth updating > Documentation/printk-formats.txt to mention that %n has intentionally > removed and will be ignored. Fine with me if you want to update that file. It doesn't currently try to be a complete man page for vsnprintf though. vsprintf.c does have kernel-doc documentation and that already does show that %n is ignored.