From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.devel Subject: Re: fix the sscanf usage in etags Date: Wed, 09 Aug 2006 10:06:24 +1000 Message-ID: <87psfa93i7.fsf@zip.com.au> References: <20060807.123850.192456906.jet@gyve.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155082029 16770 80.91.229.2 (9 Aug 2006 00:07:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 9 Aug 2006 00:07:09 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 09 02:07:07 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GAbb4-0007ob-Cb for ged-emacs-devel@m.gmane.org; Wed, 09 Aug 2006 02:06:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAbb3-0007AR-U2 for ged-emacs-devel@m.gmane.org; Tue, 08 Aug 2006 20:06:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GAbas-0007AK-Fw for emacs-devel@gnu.org; Tue, 08 Aug 2006 20:06:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GAbaq-00079v-A6 for emacs-devel@gnu.org; Tue, 08 Aug 2006 20:06:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAbaq-00079n-6O for emacs-devel@gnu.org; Tue, 08 Aug 2006 20:06:40 -0400 Original-Received: from [61.8.0.84] (helo=mailout1.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GAbfP-0002CG-43 for emacs-devel@gnu.org; Tue, 08 Aug 2006 20:11:23 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id D0A9C5A05E9 for ; Wed, 9 Aug 2006 10:06:33 +1000 (EST) Original-Received: from localhost (ppp24E5.dyn.pacific.net.au [61.8.36.229]) by mailproxy2.pacific.net.au (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k7906WKP000607 for ; Wed, 9 Aug 2006 10:06:33 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1GAbab-0003sj-00; Wed, 09 Aug 2006 10:06:25 +1000 Original-To: emacs-devel@gnu.org In-Reply-To: <20060807.123850.192456906.jet@gyve.org> (Masatake YAMATO's message of "Mon, 07 Aug 2006 12:38:50 +0900 (JST)") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58191 Archived-At: Masatake YAMATO writes: > > - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 1) > + if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 2) I think that's wrong, I believe %n is not included in the return count. Eg. in the current glibc, and in the posix spec (under "n"), http://www.opengroup.org/onlinepubs/007904975/functions/scanf.html It does look like there's a problem with degenerate input having "start" used uninitialized though. Eg. say #line 00000000000000000000000000000