Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] breakpoint.c, breakpoint_adjustment_warning, make safe from overflow
@ 2011-03-01  2:19 Michael Snyder
  2011-03-01  9:07 ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2011-03-01  2:19 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

checked in.


[-- Attachment #2: overflow3.txt --]
[-- Type: text/plain, Size: 979 bytes --]

2011-02-28  Michael Snyder  <msnyder@vmware.com>

	* breakpoint.c (breakpoint_adjustment_warning): Make local char
	buffers a little bigger, to avoid possibility of an overflow.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.545
diff -u -p -u -p -r1.545 breakpoint.c
--- breakpoint.c	28 Feb 2011 18:48:18 -0000	1.545
+++ breakpoint.c	1 Mar 2011 02:15:05 -0000
@@ -5504,8 +5504,10 @@ static void
 breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
                                int bnum, int have_bnum)
 {
-  char astr1[40];
-  char astr2[40];
+  /* The longest string possibly returned by hex_string_custom
+     is 50 chars.  These must be at least that big for safety.  */
+  char astr1[64];
+  char astr2[64];
 
   strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
   strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [commit] breakpoint.c, breakpoint_adjustment_warning, make safe from overflow
  2011-03-01  2:19 [commit] breakpoint.c, breakpoint_adjustment_warning, make safe from overflow Michael Snyder
@ 2011-03-01  9:07 ` Mark Kettenis
  2011-03-01 18:58   ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2011-03-01  9:07 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches

> Date: Mon, 28 Feb 2011 18:19:32 -0800
> From: Michael Snyder <msnyder@vmware.com>
> 
> checked in.

Just wanted to say that there's lots of good stuff in this stream of
patches, especially stuff like this where the reason for magic
constants is also documented.

Thanks Michael!

> 2011-02-28  Michael Snyder  <msnyder@vmware.com>
> 
> 	* breakpoint.c (breakpoint_adjustment_warning): Make local char
> 	buffers a little bigger, to avoid possibility of an overflow.
> 
> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.545
> diff -u -p -u -p -r1.545 breakpoint.c
> --- breakpoint.c	28 Feb 2011 18:48:18 -0000	1.545
> +++ breakpoint.c	1 Mar 2011 02:15:05 -0000
> @@ -5504,8 +5504,10 @@ static void
>  breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
>                                 int bnum, int have_bnum)
>  {
> -  char astr1[40];
> -  char astr2[40];
> +  /* The longest string possibly returned by hex_string_custom
> +     is 50 chars.  These must be at least that big for safety.  */
> +  char astr1[64];
> +  char astr2[64];
>  
>    strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
>    strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [commit] breakpoint.c, breakpoint_adjustment_warning, make safe from overflow
  2011-03-01  9:07 ` Mark Kettenis
@ 2011-03-01 18:58   ` Michael Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2011-03-01 18:58 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis wrote:
>> Date: Mon, 28 Feb 2011 18:19:32 -0800
>> From: Michael Snyder <msnyder@vmware.com>
>>
>> checked in.
> 
> Just wanted to say that there's lots of good stuff in this stream of
> patches, especially stuff like this where the reason for magic
> constants is also documented.

Thanks!  That means a lot to me!


>> 2011-02-28  Michael Snyder  <msnyder@vmware.com>
>>
>> 	* breakpoint.c (breakpoint_adjustment_warning): Make local char
>> 	buffers a little bigger, to avoid possibility of an overflow.
>>
>> Index: breakpoint.c
>> ===================================================================
>> RCS file: /cvs/src/src/gdb/breakpoint.c,v
>> retrieving revision 1.545
>> diff -u -p -u -p -r1.545 breakpoint.c
>> --- breakpoint.c	28 Feb 2011 18:48:18 -0000	1.545
>> +++ breakpoint.c	1 Mar 2011 02:15:05 -0000
>> @@ -5504,8 +5504,10 @@ static void
>>  breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
>>                                 int bnum, int have_bnum)
>>  {
>> -  char astr1[40];
>> -  char astr2[40];
>> +  /* The longest string possibly returned by hex_string_custom
>> +     is 50 chars.  These must be at least that big for safety.  */
>> +  char astr1[64];
>> +  char astr2[64];
>>  
>>    strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
>>    strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-01 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01  2:19 [commit] breakpoint.c, breakpoint_adjustment_warning, make safe from overflow Michael Snyder
2011-03-01  9:07 ` Mark Kettenis
2011-03-01 18:58   ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox