[BusyBox] [httpd] small bugfix for addEnv
Rainer Weikusat
rainer.weikusat at sncag.com
Fri Feb 18 11:40:12 MST 2005
At least according to the Linux-manpage, the value of the pointer is
undefined if an error occurs during asprintf, so checking the return
value is probably a better idea.
Index: busybox//networking/httpd.c
===================================================================
RCS file: /data/repo/busybox/networking/httpd.c,v
retrieving revision 1.3
diff -u -r1.3 httpd.c
--- busybox//networking/httpd.c 17 Feb 2005 21:02:53 -0000 1.3
+++ busybox//networking/httpd.c 18 Feb 2005 18:17:40 -0000
@@ -809,15 +809,14 @@
{
char *s = NULL;
const char *underline;
+ int rc;
if (!value)
value = "";
underline = *name_after_underline ? "_" : "";
- asprintf(&s, "%s%s%s=%s", name_before_underline, underline,
- name_after_underline, value);
- if(s) {
- putenv(s);
- }
+ rc = asprintf(&s, "%s%s%s=%s", name_before_underline, underline,
+ name_after_underline, value);
+ if (rc != -1) putenv(s);
}
#if defined(CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV) || !defined(CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY)
More information about the busybox
mailing list