httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: "locale" project
Date Mon, 22 Dec 1997 18:11:03 GMT


On Mon, 22 Dec 1997, Martin Kraemer wrote:

> 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);

Oh wow.  I never knew this.  This is such a load of crap... yes let's make
a useful strncpy.  One which properly \0 terminates in all cases as well. 

Dean


Mime
View raw message