aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-03-01 23:42:44 +0000
committerMichael Snyder <msnyder@vmware.com>2011-03-01 23:42:44 +0000
commit5e9e105f92f031c4bde048f24994799daebaa25e (patch)
treef945bd7051d0ae07c8614d2790a54c8a38c0c927
parentdc19db01c117e015c4656cfb4aa78bb9acaf8ba8 (diff)
downloadgdb-5e9e105f92f031c4bde048f24994799daebaa25e.zip
gdb-5e9e105f92f031c4bde048f24994799daebaa25e.tar.gz
gdb-5e9e105f92f031c4bde048f24994799daebaa25e.tar.bz2
2011-03-01 Michael Snyder <msnyder@vmware.com>
* cli/cli-dump.c (restore_binary_file): Validate ftell return value.
-rw-r--r--gdb/ChangeLog2
-rw-r--r--gdb/cli/cli-dump.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9259a5e..53b05e9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,7 @@
2011-03-01 Michael Snyder <msnyder@vmware.com>
+ * cli/cli-dump.c (restore_binary_file): Validate ftell return value.
+
* ada-lang.c (ada_make_symbol_completion_list): Replace malloc
with xmalloc.
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index e288ee6..4bba10c 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -511,7 +511,11 @@ restore_binary_file (char *filename, struct callback_data *data)
/* Get the file size for reading. */
if (fseek (file, 0, SEEK_END) == 0)
- len = ftell (file);
+ {
+ len = ftell (file);
+ if (len < 0)
+ perror_with_name (filename);
+ }
else
perror_with_name (filename);