aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-28 02:24:59 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-28 02:24:59 +0000
commitc4523c2b3da206312ed0b007a46eace58659ec31 (patch)
tree5d4f169b7de1d73e7948f2bf8ecad79df2f18c6b /networking
parent2570b2e5759e8ac32b0922d71056bd426caae9f1 (diff)
downloadbusybox-w32-c4523c2b3da206312ed0b007a46eace58659ec31.tar.gz
busybox-w32-c4523c2b3da206312ed0b007a46eace58659ec31.tar.bz2
busybox-w32-c4523c2b3da206312ed0b007a46eace58659ec31.zip
fix a few stray unguarded strdup's
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 5e6037cbe..b4a8d277b 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -800,7 +800,7 @@ static char *encodeString(const char *string)
800/* 800/*
801 * Given a URL encoded string, convert it to plain ascii. 801 * Given a URL encoded string, convert it to plain ascii.
802 * Since decoding always makes strings smaller, the decode is done in-place. 802 * Since decoding always makes strings smaller, the decode is done in-place.
803 * Thus, callers should strdup() the argument if they do not want the 803 * Thus, callers should xstrdup() the argument if they do not want the
804 * argument modified. The return is the original pointer, allowing this 804 * argument modified. The return is the original pointer, allowing this
805 * function to be easily used as arguments to other functions. 805 * function to be easily used as arguments to other functions.
806 * 806 *
@@ -1725,9 +1725,7 @@ static int checkPerm(const char *path, const char *request)
1725 1725
1726 if (strcmp(p, request) == 0) { 1726 if (strcmp(p, request) == 0) {
1727 set_remoteuser_var: 1727 set_remoteuser_var:
1728 remoteuser = strdup(request); 1728 remoteuser = xstrndup(request, u - request);
1729 if (remoteuser)
1730 remoteuser[u - request] = '\0';
1731 return 1; /* Ok */ 1729 return 1; /* Ok */
1732 } 1730 }
1733 /* unauthorized */ 1731 /* unauthorized */
@@ -1990,13 +1988,13 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
1990#endif 1988#endif
1991#if ENABLE_FEATURE_HTTPD_CGI 1989#if ENABLE_FEATURE_HTTPD_CGI
1992 else if (STRNCASECMP(iobuf, "Cookie:") == 0) { 1990 else if (STRNCASECMP(iobuf, "Cookie:") == 0) {
1993 cookie = strdup(skip_whitespace(iobuf + sizeof("Cookie:")-1)); 1991 cookie = xstrdup(skip_whitespace(iobuf + sizeof("Cookie:")-1));
1994 } else if (STRNCASECMP(iobuf, "Content-Type:") == 0) { 1992 } else if (STRNCASECMP(iobuf, "Content-Type:") == 0) {
1995 content_type = strdup(skip_whitespace(iobuf + sizeof("Content-Type:")-1)); 1993 content_type = xstrdup(skip_whitespace(iobuf + sizeof("Content-Type:")-1));
1996 } else if (STRNCASECMP(iobuf, "Referer:") == 0) { 1994 } else if (STRNCASECMP(iobuf, "Referer:") == 0) {
1997 referer = strdup(skip_whitespace(iobuf + sizeof("Referer:")-1)); 1995 referer = xstrdup(skip_whitespace(iobuf + sizeof("Referer:")-1));
1998 } else if (STRNCASECMP(iobuf, "User-Agent:") == 0) { 1996 } else if (STRNCASECMP(iobuf, "User-Agent:") == 0) {
1999 user_agent = strdup(skip_whitespace(iobuf + sizeof("User-Agent:")-1)); 1997 user_agent = xstrdup(skip_whitespace(iobuf + sizeof("User-Agent:")-1));
2000 } 1998 }
2001#endif 1999#endif
2002#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 2000#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
@@ -2377,7 +2375,7 @@ int httpd_main(int argc ATTRIBUTE_UNUSED, char **argv)
2377 * Besides, it is also smaller. */ 2375 * Besides, it is also smaller. */
2378 { 2376 {
2379 char *p = getenv("PATH"); 2377 char *p = getenv("PATH");
2380 /* env strings themself are not freed, no need to strdup(p): */ 2378 /* env strings themself are not freed, no need to xstrdup(p): */
2381 clearenv(); 2379 clearenv();
2382 if (p) 2380 if (p)
2383 putenv(p - 5); 2381 putenv(p - 5);