[EMAIL PROTECTED] wrote:
In the ports I maintain I usually silence all the str*/sprintf warnings
by replacing them with strl* or snprintf.  However in more than one port
update I'm working on, I notice that the authors have chosen to do this
rather than use strl*/strn*:

[...]
        char             kdir[ MAXPATHLEN ];
        [...]
        if ( strlen( path ) >= MAXPATHLEN ) {
            fprintf( stderr, "%s: path too long\n", path );
            exit( 2 );
        }
        strcpy( kdir, path );
[...]

So my question is:  should I leave the above code alone, or
is it preferred to always replace strcat/strcpy/sprintf with
strlcat/strlcpy/snprintf (checking return values of course)?

if you replace string functions in ports with strl....() equivalents, you are only making it harder to maintain the port. just don't do it.

Reply via email to