httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: "locale" project
Date Mon, 22 Dec 1997 13:09:28 GMT
Martin Kraemer wrote:
> 
> On Fri, Dec 19, 1997 at 12:17:28PM -0800, Dean Gaudet wrote:
> > You can find similar lame examples using strncpy,
> > and strncat.
> 
> Yes, but we could certainly eliminate assignments like
> 
>     strncpy(server_root, HTTPD_ROOT, sizeof(server_root) - 1);
> 
> today. What use is there in filling in the HTTPD_ROOT, and then filling
> up all the rest (up to HUGE_STRING_LEN-sizeof(HTTPD_ROOT) bytes) with
> zero characters? The functionality of strncpy() is totally broken: the
> only use for it is in the directory entry fill-in code of the
> 14-char-length Sys5 file system (there, the file names must be padded to
> length 14 with binary zeros, unless their length is 14 already. But
> probably, that's also the only place where it _isn't_ used...). For
> everyday use, strncpy() is the wrong candidate. What's needed is a
> "bounded strcpy()", something like:
>     strncat(strcpy(dest,""), srce, length);
> 

That's a good idea... we could even #define something cleanly
or create our own ap_bstrncpy()

-- 
====================================================================
      Jim Jagielski            |       jaguNET Access Services
     jim@jaguNET.com           |       http://www.jaguNET.com/
            "Look at me! I'm wearing a cardboard belt!"

Mime
View raw message