From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Snyder To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Factor out some functions in remote.c Date: Thu, 10 May 2001 12:08:00 -0000 Message-id: <3AFAE707.67003BF5@cygnus.com> References: <3AF07FD4.62C23D84@cygnus.com> <3AFA1EC2.3020902@cygnus.com> <3AFAE1DD.917D4FBE@cygnus.com> <3AFAE4F0.6010209@cygnus.com> X-SW-Source: 2001-05/msg00174.html 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.