qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] commit d354899 (Fix OpenBSD linker warning, 2010-02-23)
@ 2010-02-25 14:00 Paolo Bonzini
  2010-02-25 17:37 ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2010-02-25 14:00 UTC (permalink / raw)
  To: qemu-devel

> -                if (b)
> -                    sprintf(b, "...");
> +                if (b) {
> +                    memcpy(b, "...", sizeof("..."));
> +                }

What's wrong with strcpy? :-)  (I doubt OpenBSD warns about that too).

Paolo

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

* Re: [Qemu-devel] commit d354899 (Fix OpenBSD linker warning, 2010-02-23)
  2010-02-25 14:00 [Qemu-devel] commit d354899 (Fix OpenBSD linker warning, 2010-02-23) Paolo Bonzini
@ 2010-02-25 17:37 ` Blue Swirl
  2010-02-25 18:14   ` [Qemu-devel] " Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2010-02-25 17:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On 2/25/10, Paolo Bonzini <pbonzini@redhat.com> 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()

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

* [Qemu-devel] Re: commit d354899 (Fix OpenBSD linker warning, 2010-02-23)
  2010-02-25 17:37 ` Blue Swirl
@ 2010-02-25 18:14   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2010-02-25 18:14 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On 02/25/2010 06:37 PM, Blue Swirl wrote:
>> >
>> >    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()

That's debatable to say the least, but anyway thanks for correcting me. :-)

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

end of thread, other threads:[~2010-02-25 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-25 14:00 [Qemu-devel] commit d354899 (Fix OpenBSD linker warning, 2010-02-23) Paolo Bonzini
2010-02-25 17:37 ` Blue Swirl
2010-02-25 18:14   ` [Qemu-devel] " Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).