From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Cc: dcb314@hotmail.com
Subject: [PATCH][PR gdb/16013] Fix off-by-one errors in *scanf format strings
Date: Mon, 14 Oct 2013 10:52:00 -0000 [thread overview]
Message-ID: <20131014105252.GA5262@blade.nx> (raw)
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 <gbenson@redhat.com>
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);
next reply other threads:[~2013-10-14 10:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 10:52 Gary Benson [this message]
2013-10-14 11:25 ` Pedro Alves
2013-10-18 14:39 ` [PATCH v2][PR " Gary Benson
2013-10-18 16:38 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131014105252.GA5262@blade.nx \
--to=gbenson@redhat.com \
--cc=dcb314@hotmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox