summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-11-26 14:19:31 +0000
committerPedro Alves <palves@redhat.com>2012-11-26 14:19:31 +0000
commit54625e3a2ad2f8120edab2c4b35519c3fe448fe6 (patch)
tree318ceb93f282931d0a5f468d5038515c58b6a87f /gdb
parent210b2c6cf73a2e2ec2987dbbef629e97306578b5 (diff)
downloadgdb-54625e3a2ad2f8120edab2c4b35519c3fe448fe6.tar.gz
gdb/
2012-11-26 Maxime Villard <rustyBSD@gmx.fr> Pedro Alves <palves@redhat.com> * common/linux-osdata.c (linux_xfer_osdata_fds): Decrease buffer size parameter passed to readlink by one byte. * fbsd-nat.c (fbsd_pid_to_exec_file): Ditto. * linux-nat.c (linux_child_pid_to_exec_file): Ditto. * nbsd-nat.c (nbsd_pid_to_exec_file): Ditto. * inf-child.c (inf_child_fileio_readlink): Decrease local buffer's size by one byte. gdb/gdbserver/ 2012-11-26 Maxime Villard <rustyBSD@gmx.fr> * hostio.c (handle_readlink): Decrease buffer size parameter passed to readlink by one byte.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/common/linux-osdata.c2
-rw-r--r--gdb/fbsd-nat.c2
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/hostio.c2
-rw-r--r--gdb/inf-child.c2
-rw-r--r--gdb/linux-nat.c2
-rw-r--r--gdb/nbsd-nat.c2
8 files changed, 22 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 57aee09db71..b14fc8e002c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2012-11-26 Maxime Villard <rustyBSD@gmx.fr>
+ Pedro Alves <palves@redhat.com>
+
+ * common/linux-osdata.c (linux_xfer_osdata_fds): Decrease buffer
+ size parameter passed to readlink by one byte.
+ * fbsd-nat.c (fbsd_pid_to_exec_file): Ditto.
+ * linux-nat.c (linux_child_pid_to_exec_file): Ditto.
+ * nbsd-nat.c (nbsd_pid_to_exec_file): Ditto.
+ * inf-child.c (inf_child_fileio_readlink): Decrease local buffer's
+ size by one byte.
+
2012-11-26 Yao Qi <yao@codesourcery.com>
* f-valprint.c (f77_create_arrayprint_offset_tbl): Remove
diff --git a/gdb/common/linux-osdata.c b/gdb/common/linux-osdata.c
index d54f9d368c4..b275495e9cf 100644
--- a/gdb/common/linux-osdata.c
+++ b/gdb/common/linux-osdata.c
@@ -737,7 +737,7 @@ linux_xfer_osdata_fds (gdb_byte *readbuf,
continue;
fdname = xstrprintf ("%s/%s", pathname, dp2->d_name);
- rslt = readlink (fdname, buf, 1000);
+ rslt = readlink (fdname, buf, sizeof (buf) - 1);
if (rslt >= 0)
buf[rslt] = '\0';
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 254a01a25ba..5eaecdd609c 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -55,7 +55,7 @@ fbsd_pid_to_exec_file (int pid)
#endif
path = xstrprintf ("/proc/%d/file", pid);
- if (readlink (path, buf, MAXPATHLEN) == -1)
+ if (readlink (path, buf, MAXPATHLEN - 1) == -1)
{
xfree (buf);
buf = NULL;
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index efebfb111a0..0b1fb8109c6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-26 Maxime Villard <rustyBSD@gmx.fr>
+
+ * hostio.c (handle_readlink): Decrease buffer size
+ parameter passed to readlink by one byte.
+
2012-11-26 Yao Qi <yao@codesourcery.com>
* configure.ac (build_warnings): Append '-Wempty-body'.
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index 72e334c414c..e89e100c672 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -483,7 +483,7 @@ handle_readlink (char *own_buf, int *new_packet_len)
return;
}
- ret = readlink (filename, linkname, sizeof linkname);
+ ret = readlink (filename, linkname, sizeof (linkname) - 1);
if (ret == -1)
{
hostio_error (own_buf);
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index ae2dd1e1012..3530e75768e 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -346,7 +346,7 @@ inf_child_fileio_readlink (const char *filename, int *target_errno)
/* We support readlink only on systems that also provide a compile-time
maximum path length (MAXPATHLEN), at least for now. */
#if defined (HAVE_READLINK) && defined (MAXPATHLEN)
- char buf[MAXPATHLEN];
+ char buf[MAXPATHLEN - 1];
int len;
char *ret;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 45f7e240600..f5ca97769da 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4319,7 +4319,7 @@ linux_child_pid_to_exec_file (int pid)
memset (name2, 0, MAXPATHLEN);
sprintf (name1, "/proc/%d/exe", pid);
- if (readlink (name1, name2, MAXPATHLEN) > 0)
+ if (readlink (name1, name2, MAXPATHLEN - 1) > 0)
return name2;
else
return name1;
diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c
index 14b562f140f..7f5df6611ab 100644
--- a/gdb/nbsd-nat.c
+++ b/gdb/nbsd-nat.c
@@ -34,7 +34,7 @@ nbsd_pid_to_exec_file (int pid)
char *path;
path = xstrprintf ("/proc/%d/exe", pid);
- if (readlink (path, buf, MAXPATHLEN) == -1)
+ if (readlink (path, buf, MAXPATHLEN - 1) == -1)
{
xfree (buf);
buf = NULL;