src/sbin string functions cleanup

Sascha Wildner saw at online.de
Mon Dec 20 11:30:34 PST 2004


Andre Nathan wrote:

The paches at [1] substitute all calls to strcpy, strcat, strncpy,
strncat and sprintf by the safer strlcpy, strlcat and snprintf for
everything under src/sbin.
Andre,

I've merged your patches with my previous void cast removal. The new 
patch is here:

http://yoyodyne.ath.cx/tmp/strl.patch

Two minor issues, though:

1) Due to Joerg's previous work on ldconfig there was nothing left to 
patch there. :)

2) I've removed two additional lines of code from ping/ping.c:

snamebuf[sizeof(snamebuf) - 1] = '\0';

and

hnamebuf[sizeof(hnamebuf) - 1] = '\0';

According to strlcpy's manpage it guarantees to NUL-terminate the result 
so those two lines seemed no longer necessary. Please correct me if I'm 
wrong.

I'll be away for the next two days and will start committing this on 
Thursday.

Sascha

--
http://yoyodyne.ath.cx




More information about the Submit mailing list