qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tim <tim-qemu@sentinelchicken.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: Re: [PATCH] security_20040618
Date: Sun, 20 Jun 2004 14:57:43 -0700	[thread overview]
Message-ID: <20040620215743.GB1927@sentinelchicken.org> (raw)
In-Reply-To: <cb4qqb$qi2$1@sea.gmane.org>

> > Based on comments received thus far, including yours, I am reviewing
> > that section of code (as I mentioned above), and will be releasing a new
> > revision of the patch in a day or two.  I admit, I am not a perfect
> > programmer.  I am merely trying to help out by fixing the tiny problems
> > that are often missed by programmers that have more important things to
> > worry about.  I appreciate it when people show me where I am wrong, but
> > could you please keep your criticism a bit more constructive?
> 
> Sorry if I sounded a bit harsh, I'm sure every contribution is appreciated,
> and your submitting patches is more helpful than my criticizing them...

That's ok, I was just taken aback a bit.

> I merely wanted to emphasize how broken strncpy is and how much more useful
> pstrcpy is.
>
> My suggestion on qemu_strdup is imho constructive :-)  and about the only
> reason this is not completely off topic ;-)
> 
> But as far as strnpy is concerned, I *want* to be destructive : this C
> library function is a mess, it doesn't do what most C programmers
> believe.  It causes bugs, or blatant inefficiencies due to the inept null
> padding on large buffers.
> It is so unlikely that the precise behaviour of that horrible thing be what
> is needed in any C program...
> There are quite a few problems around uses of this function even in gnu
> software or the linux kernel.

Yes, since Fabrice pointed out the differences between my version of
pstrcpy() and his, I have come to appreciate pstrcpy()'s correctness and
speed.  I see what you mean by the problems with strncpy(), and I'll
make an effort to eliminate it with the same prejudice I have tried to
eliminate most strcpy() and sprintf() calls.

> There are other candidates for libc functions every programmer should reject
> disgruntedly : sprintf, gets, strtok, mktemp, tmpnam,
> tempnam... or any of the C library functions duly tagged in the man pages as
> never to be used
> Similarly, extreme care is needed in do/while loops...

Agreed.  In this day and age, there's really no excuse to use unsafe
functions such as these.  That's why I attempt to eliminate them with my
patch even though there may be no immediately obvious overflow issue.

Thanks for the additional comments & information.

cheers,
tim

  reply	other threads:[~2004-06-20 21:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200406181841.i5IIfZQa019337@treas.simtreas.ru>
2004-06-19  7:33 ` [Qemu-devel] Errors compiling QEMU with Mingw Vladimir N. Oleynik
2004-06-19  7:37 ` [Qemu-devel] [PATCH] security_20040618 Vladimir N. Oleynik
2004-06-19 15:05   ` Tim
2004-06-20 18:22     ` [Qemu-devel] " Charlie Gordon
2004-06-20 19:26       ` Tim
2004-06-20 20:10         ` [Qemu-devel] " Charlie Gordon
2004-06-20 21:57           ` Tim [this message]
2004-06-21  8:50           ` OT: C Q/As, was Re: [Qemu-devel] security_20040618 Christof Petig
2004-06-21 10:21             ` [Qemu-devel] OT: C Q/As, was security_20040618 Charlie Gordon
2004-06-21 10:41               ` Christof Petig
2004-06-21 15:44           ` OT: C Q/As, was Re: [Qemu-devel] security_20040618 Michael Jennings
2004-06-22  9:57             ` [Qemu-devel] Re: completely OT: C Q/As, was security_20040618 Charlie Gordon
2004-06-22 10:49               ` Sander Nagtegaal
2004-06-22 12:37                 ` [Qemu-devel] " Charlie Gordon
2004-06-22 15:38               ` [Qemu-devel] Re: completely OT: C Q/As Michael Jennings
2004-06-24 14:21                 ` [Qemu-devel] Re: Re: completely OT: C Q/As : let's feed the troll Charlie Gordon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040620215743.GB1927@sentinelchicken.org \
    --to=tim-qemu@sentinelchicken.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).