Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Factor out some functions in remote.c
Date: Thu, 10 May 2001 11:59:00 -0000	[thread overview]
Message-ID: <3AFAE4F0.6010209@cygnus.com> (raw)
In-Reply-To: <3AFAE1DD.917D4FBE@cygnus.com>

> No, I need it.  I just haven't submitted the new code that needs it yet.
> I think fixed length buffers and null terminated strings are both reasonable
> input.  If you want me to code two separate functions, one for fixed length
> buffers and one for null terminated strings, I will (but I'll be sad).

This relates bach to strncpy() vs strlcpy() and things like asprintf() 
vs sprintf().  If you've not heard of it strlcpy() takes a parameter 
that determines the size of the _destionation_ buffer and not the source 
buffer.  This dramatically reduced the chance of buffer overruns.

I would prefer that these conversion functions always took a parameter 
that determined the size of the destination buffer.  If nothing else, 
could you code call it as something like hex2bin(src,dest,strlen(src))?

	Andrew


  reply	other threads:[~2001-05-10 11:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-02 14:45 Michael Snyder
2001-05-10  8:33 ` Andrew Cagney
2001-05-10 11:46   ` Michael Snyder
2001-05-10 11:59     ` Andrew Cagney [this message]
2001-05-10 12:08       ` Michael Snyder

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=3AFAE4F0.6010209@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@cygnus.com \
    /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