Bug 13405 - May write to read-only memory.
Summary: May write to read-only memory.
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.3
: P2 normal
Target Milestone: 7.5
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 14:10 UTC by xuzhongxing
Modified: 2012-02-02 16:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xuzhongxing 2011-11-12 14:10:12 UTC
In tui-win.c, parse_scrolling_args(),

   char *wname;
   int i;

   if (*buf_ptr == ' ')
     while (*(++buf_ptr) == ' ')
       ;

   if (*buf_ptr != (char) 0)
     wname = buf_ptr;
   else
     wname = "?";


   for (i = 0; i < strlen (wname); i++)
     wname[i] = toupper (wname[i]);

wname may points to string literal, which is read-only.
Comment 1 Sourceware Commits 2012-02-02 16:22:45 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	tromey@sourceware.org	2012-02-02 16:22:23

Modified files:
	gdb            : ChangeLog 
	gdb/tui        : tui-win.c 

Log message:
	PR gdb/13405:
	* tui/tui-win.c (parse_scrolling_args): Don't write to possibly
	read-only memory.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13801&r2=1.13802
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/tui/tui-win.c.diff?cvsroot=src&r1=1.56&r2=1.57
Comment 2 Tom Tromey 2012-02-02 16:23:14 UTC
Thanks for the report.
I checked in a fix.