This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] cli-dump.c, restore_binary_file, validate ftell return value.
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 01 Mar 2011 15:43:49 -0800
- Subject: [commit] cli-dump.c, restore_binary_file, validate ftell return value.
Checked in.
2011-03-01 Michael Snyder <msnyder@vmware.com>
* cli/cli-dump.c (restore_binary_file): Validate ftell return value.
Index: cli/cli-dump.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-dump.c,v
retrieving revision 1.41
diff -u -p -u -p -r1.41 cli-dump.c
--- cli/cli-dump.c 21 Feb 2011 18:13:17 -0000 1.41
+++ cli/cli-dump.c 1 Mar 2011 23:41:34 -0000
@@ -511,7 +511,11 @@ restore_binary_file (char *filename, str
/* 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);