OSDN Git Service

2011-03-01 Michael Snyder <msnyder@vmware.com>
authormsnyder <msnyder>
Tue, 1 Mar 2011 23:42:44 +0000 (23:42 +0000)
committermsnyder <msnyder>
Tue, 1 Mar 2011 23:42:44 +0000 (23:42 +0000)
* cli/cli-dump.c (restore_binary_file): Validate ftell return value.

gdb/ChangeLog
gdb/cli/cli-dump.c

index 9259a5e..53b05e9 100644 (file)
@@ -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.
 
index e288ee6..4bba10c 100644 (file)
@@ -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);