httpd: addEnv() brainstorming

Vladimir N. Oleynik dzo at simtreas.ru
Mon Sep 5 16:16:24 UTC 2005


Dirk,

> Here is an other recommendation for addEnv()
> 
> static void addEnv(const char *name_before_underline,
>             const char *name_after_underline, const char *value)
> {
>   char buf[50]; // this is enough space for all names used in httpd

Hmm. Its very small, example for *_URI or *_PATH.

>   if ( snprintf(buf,sizeof(buf), "%s%s%s=%s",
>            name_before_underline,
>            *name_after_underline ? "_" : "",
>            name_after_underline ) >= 0

Its bad idea: libc depended.
snprintf return > 0 if buf have small size, then this value is required size.


--w
vodz



More information about the busybox mailing list