This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] buffer overflow in symtab_from_filename
- From: Aleksandar Ristovski <aristovski at qnx dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 25 Aug 2011 12:04:54 -0400
- Subject: [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++;