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]

[patch] buffer overflow in symtab_from_filename


Hello,

There is an issue in symtab_from_filename function, it may buffer overflow by advancing past the end of the string.

The patch makes sure we do not advance past zero terminator.

Thanks,

Aleksandar Ristovski
QNX Software Systems


ChangeLog: Aleksandar Ristovski <aristovski@qnx.com>

* linespec.c (symtab_from_filename): Check for the end of string.


Index: gdb/linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.129
diff -u -p -r1.129 linespec.c
--- gdb/linespec.c	18 Aug 2011 16:17:38 -0000	1.129
+++ gdb/linespec.c	25 Aug 2011 15:55:21 -0000
@@ -1835,6 +1835,8 @@ symtab_from_filename (char **argptr, cha
     }
 
   /* Discard the file name from the arg.  */
+  if (*p1 == '\0')
+    return file_symtab;
   p = p1 + 1;
   while (*p == ' ' || *p == '\t')
     p++;

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