From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13534 invoked by alias); 14 Oct 2013 10:52:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13518 invoked by uid 89); 14 Oct 2013 10:52:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Oct 2013 10:52:56 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9EAqshh029023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Oct 2013 06:52:54 -0400 Received: from blade.nx (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9EAqrnO020297; Mon, 14 Oct 2013 06:52:54 -0400 Received: by blade.nx (Postfix, from userid 1000) id AFEB5264B7C; Mon, 14 Oct 2013 11:52:52 +0100 (BST) Date: Mon, 14 Oct 2013 10:52:00 -0000 From: Gary Benson To: gdb-patches@sourceware.org Cc: dcb314@hotmail.com Subject: [PATCH][PR gdb/16013] Fix off-by-one errors in *scanf format strings Message-ID: <20131014105252.GA5262@blade.nx> Mail-Followup-To: gdb-patches@sourceware.org, dcb314@hotmail.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00429.txt.bz2 Hi all, This patch fixes a number of off-by-one errors in *scanf format strings. Ok to commit? Thanks, Gary -- http://gbenson.net/ 2013-10-14 Gary Benson PR 16013 * common/linux-osdata.c (command_from_pid): Fix off-by-one error in fscanf format string. (print_sockets): Fix off-by-one error in sscanf format string. (linux_xfer_osdata_modules): Likewise. diff --git a/gdb/common/linux-osdata.c b/gdb/common/linux-osdata.c index 9723839..8ebbab8 100644 --- a/gdb/common/linux-osdata.c +++ b/gdb/common/linux-osdata.c @@ -137,7 +137,7 @@ command_from_pid (char *command, int maxlen, PID_T pid) (for the brackets). */ char cmd[32]; PID_T stat_pid; - int items_read = fscanf (fp, "%lld %32s", &stat_pid, cmd); + int items_read = fscanf (fp, "%lld %31s", &stat_pid, cmd); if (items_read == 2 && pid == stat_pid) { @@ -880,7 +880,7 @@ print_sockets (unsigned short family, int tcp, struct buffer *buffer) int result; result = sscanf (buf, - "%d: %33[0-9A-F]:%X %33[0-9A-F]:%X %X %X:%X %X:%lX %X %d %d %lu %512s\n", + "%d: %33[0-9A-F]:%X %33[0-9A-F]:%X %X %X:%X %X:%lX %X %d %d %lu %511s\n", &sl, local_address, &local_port, remote_address, &remote_port, @@ -1471,7 +1471,7 @@ linux_xfer_osdata_modules (gdb_byte *readbuf, int items_read; items_read = sscanf (buf, - "%64s %d %d %256s %16s 0x%llx", + "%63s %d %d %255s %15s 0x%llx", name, &size, &uses, dependencies, status, &address);