From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EVAIAUUE8mo21zoAWB0awg (envelope-from ) for ; Mon, 09 Nov 2026 12:35:01 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=luDm3w+5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 00D791E0DC; Mon, 09 Nov 2026 12:35:00 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6A5831E023 for ; Mon, 09 Nov 2026 12:35:00 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CD3324BA23E2 for ; Mon, 9 Nov 2026 17:34:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD3324BA23E2 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=luDm3w+5 Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 7F2F44B99F54 for ; Mon, 9 Nov 2026 17:27:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F2F44B99F54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F2F44B99F54 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794245272; cv=none; b=YG18pqZsb9ztNY7CsDWaZgR+4nQcAXdpkZtoTIs0p/UxEtGoD60ALTkA/dOqkZBZDQ+eJLHFiV1BcpnWUY+WgzX7VHoec1yBmouH3VwJqMNUppIvpFb/JQKzAYFeA1x+OBcTdNSpU4g+TmjuZiUGlDVulgsk9bcF3JiaM07NXkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794245272; c=relaxed/simple; bh=E/9oJscdRjN3pyewrR0sCGM2zaU46p00imXViGEHZLQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=afkwN4PXKZaFaIEIMhYMBTUPcboio975+be/Jl5WLAVGjBVoLxnrP5KkDwyopZblrWGwVUbDkKZfmwJ3HYS+Mw4oqvbIedxU3E60U6t6zHwsw7/rfCt+feLw9SB4gcDhPff4KWAUEm124weNOkKoTRzS885ZktMAX7SYlNoc8H4= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=luDm3w+5 reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F2F44B99F54 Received: from eig-obgw-6003b.ext.cloudfilter.net ([10.0.30.175]) by cmsmtp with ESMTPS id QRanxOQlMAR1iQT9rxX71e; Mon, 09 Nov 2026 17:27:51 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id QT9qxHPDAGh2BQT9rxusie; Mon, 09 Nov 2026 17:27:51 +0000 X-Authority-Analysis: v=2.4 cv=Aszu3P9P c=1 sm=1 tr=0 ts=6af20297 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=zJRp6_cAMcgA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=mveotq-JHgai5eWba_gA:9 a=zgiPjhLxNE0A:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7qm9dvkDRGKU1j7lWPiTBm/pSWRGk2X9Zi+h0+J1QIU=; b=luDm3w+5gwhHOvqGe5aYD63tnP GyKHmz6lEbifVa1JwGMpmS0ogze13G67FSrGriw00qeNVPuNlmNyC0MO87ppGLi2M1pViBET0GtOq oj2KthP9TMvETpTXnE9z/t/DY; Received: from 97-122-110-129.hlrn.qwest.net ([97.122.110.129]:35786 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xQT9q-00000002GmK-1fGq; Mon, 09 Nov 2026 10:27:50 -0700 From: Tom Tromey To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/3] gdb/remote: improve error checking for 'p' packet reply In-Reply-To: <74dfd6c36ec51bc513bc84ec5480d8c3421ca3a4.1794238395.git.aburgess@redhat.com> (Andrew Burgess's message of "Mon, 9 Nov 2026 15:35:52 +0000") References: <74dfd6c36ec51bc513bc84ec5480d8c3421ca3a4.1794238395.git.aburgess@redhat.com> X-Attribution: Tom Date: Mon, 09 Nov 2026 10:27:49 -0700 Message-ID: <875wy5vrsa.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.129 X-Source-L: No X-Exim-ID: 1xQT9q-00000002GmK-1fGq X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-129.hlrn.qwest.net (bapiya) [97.122.110.129]:35786 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIKyW6aGTJNEEy8VeGPD7v4ckn6HmwTbivyGzm2sOkJmKCPOWcrSwNzgAI4D6dx8fjKa1m9L85cSVRTG/d6xz0qI7OwQRrauwRFb6jTGitCW1ty9OdJH cyZ55ozr11dKDKuNwlsFZ0AqMiTUgfNnwKZoPLgD8OsB/JdgeKX2Pl89/N2lZX4uWpnuWe9B7i4iZ4ifYyNjLEpDJmYSERG+3CU= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >>>>> "Andrew" == Andrew Burgess writes: Andrew> When building the outgoing packet use xsnprintf; this allows for Andrew> bounds checking as the packet is being written. The chances of the Andrew> outgoing packet overflowing are pretty slim, but using a bounded write Andrew> seems better than not, so let's do that. I suppose for this to assert we'd have to have a packet that's smaller than a register number and the register value. But I guess we anticipate that this can't really happen? Or is pathological enough that we don't care? Andrew> + /* Otherwise, parse the register value from the hex string. */ Andrew> + struct gdbarch *gdbarch = regcache->arch (); Andrew> + int reg_size = register_size (gdbarch, reg->regnum); Andrew> + gdb_byte *regp = (gdb_byte *) alloca (reg_size); I would prefer it if we didn't add new calls to alloca to the tree. I think alloca is bad and that generally we will not notice an extra allocation. Tom