From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8202 invoked by alias); 1 Mar 2011 18:58:11 -0000 Received: (qmail 8194 invoked by uid 22791); 1 Mar 2011 18:58:10 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Mar 2011 18:58:06 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 0052713033; Tue, 1 Mar 2011 10:58:05 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost2.vmware.com (Postfix) with ESMTP id E9DDD8EE15; Tue, 1 Mar 2011 10:58:04 -0800 (PST) Message-ID: <4D6D41BC.6040301@vmware.com> Date: Tue, 01 Mar 2011 18:58:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Mark Kettenis CC: "gdb-patches@sourceware.org" Subject: Re: [commit] breakpoint.c, breakpoint_adjustment_warning, make safe from overflow References: <4D6C57B4.70807@vmware.com> <201103010907.p2197biT001306@glazunov.sibelius.xs4all.nl> In-Reply-To: <201103010907.p2197biT001306@glazunov.sibelius.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00038.txt.bz2 Mark Kettenis wrote: >> Date: Mon, 28 Feb 2011 18:19:32 -0800 >> From: Michael Snyder >> >> 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 >> >> * 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));