Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb@sources.redhat.com, gdb-patches@sources.redhat.com,
	mark.kettenis@xs4all.nl
Subject: Re: about the usage of sprintf in gdb, specifically in gdb/remote.c
Date: Thu, 26 May 2005 03:11:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.63.0505260226350.22654@plinuxt18.cn.ibm.com> (raw)
In-Reply-To: <u3bsbma8l.fsf@gnu.org>

On Wed, 25 May 2005, Eli Zaretskii wrote:

> That might be so today, but if some day someone changes either the
> size of buf[] or the format string, things could become messy.
> 
> I'd say, if we leave sprintf here, let's at least use sizeof(buf) in
> the call to sprintf instead of a literal 8 in the format string.

Yes, you are right.  With this point in mind, I prefer to use xsnprint in 
this place too. 

> As for the other 2 examples, I'd use safer functions there.  It's
> unreasonable to request that Joe Random Hacker who happens to read the
> code should perform the amount of analysis you demonstrated to
> convince him/herself that the code is safe.  Most programmers won't go
> to such lengths.

Yes, I bet that too.  My intention in doing so is only to see whether 
there are any really overflow.  It is purely out of curiosity.  :-)

BTW, what is your point on my analysis in section 3.1.  I believe
it might incur an overflow.  But I need to design a scenario to verify 
that.  

Cheers
- Wu Zhou


  reply	other threads:[~2005-05-26  1:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-25 13:00 Wu Zhou
2005-05-26  1:41 ` Eli Zaretskii
2005-05-26  3:11   ` Wu Zhou [this message]
2005-05-26  3:47     ` Eli Zaretskii
2005-05-26  6:37       ` Wu Zhou

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=Pine.LNX.4.63.0505260226350.22654@plinuxt18.cn.ibm.com \
    --to=woodzltc@cn.ibm.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /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