This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: fix possible crash in find_charset_names


We got a report in Red Hat bugzilla about a crash in find_charset_names:

https://bugzilla.redhat.com/show_bug.cgi?id=786091

I don't have a test case but the fix is obvious enough to go in without
one.

Tom

2012-02-07  Tom Tromey  <tromey@redhat.com>

	* charset.c (find_charset_names): Check 'in' against NULL.

diff --git a/gdb/charset.c b/gdb/charset.c
index 62977d1..16dab6b 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -839,7 +839,7 @@ find_charset_names (void)
 	 parse the glibc and libiconv formats; feel free to add others
 	 as needed.  */
 
-      while (!feof (in))
+      while (in != NULL && !feof (in))
 	{
 	  /* The size of buf is chosen arbitrarily.  */
 	  char buf[1024];


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]