From 8fe413c3e9766ef4ab1432090d1bbf06dd98c19d Mon Sep 17 00:00:00 2001 From: msnyder Date: Mon, 25 Mar 2002 19:47:39 +0000 Subject: [PATCH] 2002-03-25 Jeff Law (law@redhat.com) * linux-proc.c (read_mapping): Scan up to end of line for filename. --- gdb/ChangeLog | 4 ++++ gdb/linux-proc.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 948ecc99d4..0500e9475c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2002-03-25 Jeff Law (law@redhat.com) + + * linux-proc.c (read_mapping): Scan up to end of line for filename. + 2002-03-25 Michal Ludvig * x86-64-tdep.c (x86_64_skip_prologue): Rewritten from scratch. diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index d6f88d33ce..832f14eb91 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -77,7 +77,14 @@ read_mapping (FILE *mapfile, if (ret > 0 && ret != EOF && *inode != 0) { - ret += fscanf (mapfile, "%s\n", filename); + /* Eat everything up to EOL for the filename. This will prevent + weird filenames (such as one with embedded whitespace) from + confusing this code. It also makes this code more robust + in respect to annotations the kernel may add after the + filename. + + Note the filename is used for informational purposes only. */ + ret += fscanf (mapfile, "%[^\n]\n", filename); } else { -- 2.11.0