This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Factor out some functions in remote.c
Andrew Cagney wrote:
>
> > 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))?
Yes, OK, I'll make that change.