From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nkhes-0002Ti-MG for qemu-devel@nongnu.org; Thu, 25 Feb 2010 12:37:54 -0500 Received: from [199.232.76.173] (port=37073 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nkhes-0002TY-8z for qemu-devel@nongnu.org; Thu, 25 Feb 2010 12:37:54 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nkher-0002Ri-Ju for qemu-devel@nongnu.org; Thu, 25 Feb 2010 12:37:54 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:56471) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nkher-0002Re-9X for qemu-devel@nongnu.org; Thu, 25 Feb 2010 12:37:53 -0500 Received: by pwi4 with SMTP id 4so5185124pwi.4 for ; Thu, 25 Feb 2010 09:37:52 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 25 Feb 2010 19:37:52 +0200 Message-ID: Subject: Re: [Qemu-devel] commit d354899 (Fix OpenBSD linker warning, 2010-02-23) From: Blue Swirl Content-Type: text/plain; charset=UTF-8 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 2/25/10, Paolo Bonzini wrote: > > - if (b) > > - sprintf(b, "..."); > > + if (b) { > > + memcpy(b, "...", sizeof("...")); > > + } > > > > What's wrong with strcpy? :-) (I doubt OpenBSD warns about that too). But of course, with code containing strcpy() you get this: LINK i386-softmmu/qemu i386-dis.o(.text+0x3aac): In function `oappend': /src/qemu/i386-dis.c:4656: warning: strcpy() is almost always misused, p lease use strlcpy() /usr/X11R6/lib/libX11.so.11.2: warning: strcat() is almost always misuse d, please use strlcat() /usr/X11R6/lib/libX11.so.11.2: warning: sprintf() is often misused, plea se use snprintf() With clean code, the only warnings come from X11 libraries: LINK sparc64-softmmu/qemu-system-sparc64 /usr/X11R6/lib/libX11.so.11.2: warning: strcpy() is almost always misuse d, please use strlcpy() /usr/X11R6/lib/libX11.so.11.2: warning: strcat() is almost always misuse d, please use strlcat() /usr/X11R6/lib/libX11.so.11.2: warning: sprintf() is often misused, plea se use snprintf()