diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:58 +0000 |
commit | ab2aea44479fd6f519bccd651a37f30e792b7593 (patch) | |
tree | 443636e12ffb52db95168013bbda80f78ed49fe6 /networking/httpd.c | |
parent | 06c0a71d2315756db874e98bc4f760ca3283b6a6 (diff) | |
download | busybox-w32-ab2aea44479fd6f519bccd651a37f30e792b7593.tar.gz busybox-w32-ab2aea44479fd6f519bccd651a37f30e792b7593.tar.bz2 busybox-w32-ab2aea44479fd6f519bccd651a37f30e792b7593.zip |
preparatory patch for -Wwrite-strings #4
Diffstat (limited to 'networking/httpd.c')
-rw-r--r-- | networking/httpd.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index ea9fe0974..e3f798c4c 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -653,17 +653,16 @@ static char *encodeString(const char *string) | |||
653 | /* take the simple route and encode everything */ | 653 | /* take the simple route and encode everything */ |
654 | /* could possibly scan once to get length. */ | 654 | /* could possibly scan once to get length. */ |
655 | int len = strlen(string); | 655 | int len = strlen(string); |
656 | char *out = malloc(len * 6 + 1); | 656 | char *out = xmalloc(len * 6 + 1); |
657 | char *p = out; | 657 | char *p = out; |
658 | char ch; | 658 | char ch; |
659 | 659 | ||
660 | if (!out) return ""; | ||
661 | while ((ch = *string++)) { | 660 | while ((ch = *string++)) { |
662 | // very simple check for what to encode | 661 | // very simple check for what to encode |
663 | if (isalnum(ch)) *p++ = ch; | 662 | if (isalnum(ch)) *p++ = ch; |
664 | else p += sprintf(p, "&#%d;", (unsigned char) ch); | 663 | else p += sprintf(p, "&#%d;", (unsigned char) ch); |
665 | } | 664 | } |
666 | *p = 0; | 665 | *p = '\0'; |
667 | return out; | 666 | return out; |
668 | } | 667 | } |
669 | #endif /* FEATURE_HTTPD_ENCODE_URL_STR */ | 668 | #endif /* FEATURE_HTTPD_ENCODE_URL_STR */ |
@@ -1051,15 +1050,15 @@ static int sendCgi(const char *url, | |||
1051 | /* (Older versions of bbox seem to do some decoding) */ | 1050 | /* (Older versions of bbox seem to do some decoding) */ |
1052 | setenv1("QUERY_STRING", config->query); | 1051 | setenv1("QUERY_STRING", config->query); |
1053 | setenv1("SERVER_SOFTWARE", httpdVersion); | 1052 | setenv1("SERVER_SOFTWARE", httpdVersion); |
1054 | putenv("SERVER_PROTOCOL=HTTP/1.0"); | 1053 | putenv((char*)"SERVER_PROTOCOL=HTTP/1.0"); |
1055 | putenv("GATEWAY_INTERFACE=CGI/1.1"); | 1054 | putenv((char*)"GATEWAY_INTERFACE=CGI/1.1"); |
1056 | /* Having _separate_ variables for IP and port defeats | 1055 | /* Having _separate_ variables for IP and port defeats |
1057 | * the purpose of having socket abstraction. Which "port" | 1056 | * the purpose of having socket abstraction. Which "port" |
1058 | * are you using on Unix domain socket? | 1057 | * are you using on Unix domain socket? |
1059 | * IOW - REMOTE_PEER="1.2.3.4:56" makes much more sense. | 1058 | * IOW - REMOTE_PEER="1.2.3.4:56" makes much more sense. |
1060 | * Oh well... */ | 1059 | * Oh well... */ |
1061 | { | 1060 | { |
1062 | char *p = config->rmt_ip_str ? : ""; | 1061 | char *p = config->rmt_ip_str ? : (char*)""; |
1063 | char *cp = strrchr(p, ':'); | 1062 | char *cp = strrchr(p, ':'); |
1064 | if (ENABLE_FEATURE_IPV6 && cp && strchr(cp, ']')) | 1063 | if (ENABLE_FEATURE_IPV6 && cp && strchr(cp, ']')) |
1065 | cp = NULL; | 1064 | cp = NULL; |
@@ -1078,7 +1077,7 @@ static int sendCgi(const char *url, | |||
1078 | #if ENABLE_FEATURE_HTTPD_BASIC_AUTH | 1077 | #if ENABLE_FEATURE_HTTPD_BASIC_AUTH |
1079 | if (config->remoteuser) { | 1078 | if (config->remoteuser) { |
1080 | setenv1("REMOTE_USER", config->remoteuser); | 1079 | setenv1("REMOTE_USER", config->remoteuser); |
1081 | putenv("AUTH_TYPE=Basic"); | 1080 | putenv((char*)"AUTH_TYPE=Basic"); |
1082 | } | 1081 | } |
1083 | #endif | 1082 | #endif |
1084 | if (config->referer) | 1083 | if (config->referer) |