From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kt8Ef-00064a-Rx for qemu-devel@nongnu.org; Thu, 23 Oct 2008 18:00:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kt8EX-00061U-IE for qemu-devel@nongnu.org; Thu, 23 Oct 2008 18:00:53 -0400 Received: from [199.232.76.173] (port=33318 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kt8EX-00061J-9f for qemu-devel@nongnu.org; Thu, 23 Oct 2008 18:00:45 -0400 Received: from outbound.icp-qv1-irony-out1.iinet.net.au ([203.59.1.108]:56670) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kt8EW-0004Mo-Hm for qemu-devel@nongnu.org; Thu, 23 Oct 2008 18:00:45 -0400 Date: Fri, 24 Oct 2008 09:00:31 +1100 From: Erik de Castro Lopo Subject: Re: [Qemu-devel] [PATCH] fix bad memcpy length Message-Id: <20081024090031.c33c1c53.mle+tools@mega-nerd.com> In-Reply-To: <49009C800200004800060A7C@lucius.provo.novell.com> References: <49009C800200004800060A7C@lucius.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Bruce Rogers Bruce Rogers wrote: > --- a/qemu/trunk/hw/bt-sdp.c > +++ b/qemu/trunk/hw/bt-sdp.c > @@ -254,7 +254,7 @@ > /* Perform the search */ > if (len < 7) > return -SDP_INVALID_SYNTAX; > - memcpy(&handle, req, 6); > + memcpy(&handle, req, 4); Changing one magic number to another doesn't make much sense. Why not this instead: memcpy(&handle, req, sizeof (handle)); Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "life is too long to know C++ well" -- Erik Naggum