You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2002/06/18 03:00:00 UTC
cvs commit: apache-1.3/src/os/win32 mod_isapi.c
jim 2002/06/17 18:00:00
Modified: src/main http_core.c http_protocol.c util.c util_uri.c
src/modules/experimental mod_auth_digest.c
src/modules/proxy mod_proxy.c proxy_http.c proxy_util.c
src/modules/standard mod_mime_magic.c
src/modules/test mod_rndchunk.c
src/os/win32 mod_isapi.c
Log:
Migrate from strtol to ap_strtol, and use its known capability
Revision Changes Path
1.313 +1 -1 apache-1.3/src/main/http_core.c
Index: http_core.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.312
retrieving revision 1.313
diff -u -r1.312 -r1.313
--- http_core.c 17 May 2002 18:01:57 -0000 1.312
+++ http_core.c 18 Jun 2002 00:59:57 -0000 1.313
@@ -2891,7 +2891,7 @@
* Instead we have an idiotic define in httpd.h that prevents
* it from being used even when it is available. Sheesh.
*/
- conf->limit_req_body = (unsigned long)strtol(arg, (char **)NULL, 10);
+ conf->limit_req_body = (unsigned long)ap_strtol(arg, (char **)NULL, 10);
return NULL;
}
1.319 +13 -10 apache-1.3/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.318
retrieving revision 1.319
diff -u -r1.318 -r1.319
--- http_protocol.c 17 Jun 2002 19:38:19 -0000 1.318
+++ http_protocol.c 18 Jun 2002 00:59:57 -0000 1.319
@@ -171,7 +171,7 @@
}
if (ap_isdigit(*r->range))
- *start = strtol(r->range, (char **)&r->range, 10);
+ *start = ap_strtol(r->range, (char **)&r->range, 10);
else
*start = -1;
@@ -186,7 +186,7 @@
++r->range;
if (ap_isdigit(*r->range))
- *end = strtol(r->range, (char **)&r->range, 10);
+ *end = ap_strtol(r->range, (char **)&r->range, 10);
else
*end = -1;
@@ -1984,20 +1984,23 @@
}
else if (lenp) {
const char *pos = lenp;
+ int conversion_error = 0;
while (ap_isdigit(*pos) || ap_isspace(*pos))
++pos;
- if (*pos != '\0') {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
- "Invalid Content-Length %s", lenp);
- return HTTP_BAD_REQUEST;
+
+ if (*pos == '\0') {
+ char *endstr;
+ errno = 0;
+ r->remaining = ap_strtol(lenp, &endstr, 10);
+ if (errno || (endstr && *endstr)) {
+ conversion_error = 1;
+ }
}
- r->remaining = atol(lenp);
- if (r->remaining < 0) {
+ if (*pos != '\0' || conversion_error) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
- "Request content-length of %s maps to negative number %ld",
- lenp, r->remaining);
+ "Invalid Content-Length");
return HTTP_BAD_REQUEST;
}
}
1.206 +1 -1 apache-1.3/src/main/util.c
Index: util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -r1.205 -r1.206
--- util.c 23 May 2002 03:25:20 -0000 1.205
+++ util.c 18 Jun 2002 00:59:58 -0000 1.206
@@ -1569,7 +1569,7 @@
xstr[2]=what[0];
xstr[3]=what[1];
xstr[4]='\0';
- digit = os_toebcdic[0xFF & strtol(xstr, NULL, 16)];
+ digit = os_toebcdic[0xFF & ap_strtol(xstr, NULL, 16)];
#endif /*CHARSET_EBCDIC*/
return (digit);
}
1.39 +2 -2 apache-1.3/src/main/util_uri.c
Index: util_uri.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/util_uri.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- util_uri.c 13 Mar 2002 21:05:31 -0000 1.38
+++ util_uri.c 18 Jun 2002 00:59:58 -0000 1.39
@@ -428,7 +428,7 @@
++s;
uptr->port_str = ap_pstrndup(p, s, uri - s);
if (uri != s) {
- port = strtol(uptr->port_str, &endstr, 10);
+ port = ap_strtol(uptr->port_str, &endstr, 10);
uptr->port = port;
if (*endstr == '\0') {
goto deal_with_path;
@@ -483,7 +483,7 @@
++s;
uptr->port_str = ap_pstrdup(p, s);
if (*s != '\0') {
- uptr->port = (unsigned short)strtol(uptr->port_str, &endstr, 10);
+ uptr->port = (unsigned short)ap_strtol(uptr->port_str, &endstr, 10);
if (*endstr == '\0') {
return HTTP_OK;
}
1.24 +3 -3 apache-1.3/src/modules/experimental/mod_auth_digest.c
Index: mod_auth_digest.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/experimental/mod_auth_digest.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- mod_auth_digest.c 13 Mar 2002 21:05:32 -0000 1.23
+++ mod_auth_digest.c 18 Jun 2002 00:59:59 -0000 1.24
@@ -573,7 +573,7 @@
char *endptr;
long lifetime;
- lifetime = strtol(t, &endptr, 10);
+ lifetime = ap_strtol(t, &endptr, 10);
if (endptr < (t+strlen(t)) && !ap_isspace(*endptr))
return ap_pstrcat(cmd->pool, "Invalid time in AuthDigestNonceLifetime: ", t, NULL);
@@ -933,7 +933,7 @@
}
if (resp->opaque)
- resp->opaque_num = (unsigned long) strtol(resp->opaque, NULL, 16);
+ resp->opaque_num = (unsigned long) ap_strtol(resp->opaque, NULL, 16);
resp->auth_hdr_sts = VALID;
return OK;
@@ -1375,7 +1375,7 @@
if (!conf->check_nc || !client_mm)
return OK;
- nc = strtol(snc, &endptr, 16);
+ nc = ap_strtol(snc, &endptr, 16);
if (endptr < (snc+strlen(snc)) && !ap_isspace(*endptr)) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
"Digest: invalid nc %s received - not a number", snc);
1.83 +1 -1 apache-1.3/src/modules/proxy/mod_proxy.c
Index: mod_proxy.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- mod_proxy.c 24 Apr 2002 17:37:50 -0000 1.82
+++ mod_proxy.c 18 Jun 2002 00:59:59 -0000 1.83
@@ -305,7 +305,7 @@
if (r->method_number == M_TRACE &&
(maxfwd_str = ap_table_get(r->headers_in, "Max-Forwards")) != NULL) {
- long maxfwd = strtol(maxfwd_str, NULL, 10);
+ long maxfwd = ap_strtol(maxfwd_str, NULL, 10);
if (maxfwd < 1) {
int access_status;
r->proxyreq = NOT_PROXY;
1.100 +1 -1 apache-1.3/src/modules/proxy/proxy_http.c
Index: proxy_http.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- proxy_http.c 30 May 2002 10:19:49 -0000 1.99
+++ proxy_http.c 18 Jun 2002 00:59:59 -0000 1.100
@@ -517,7 +517,7 @@
content_length = ap_table_get(resp_hdrs, "Content-Length");
if (content_length != NULL) {
- c->len = strtol(content_length, NULL, 10);
+ c->len = ap_strtol(content_length, NULL, 10);
}
/* Now add out bound headers set by other modules */
1.125 +2 -2 apache-1.3/src/modules/proxy/proxy_util.c
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- proxy_util.c 17 Jun 2002 18:14:12 -0000 1.124
+++ proxy_util.c 18 Jun 2002 00:59:59 -0000 1.125
@@ -1072,7 +1072,7 @@
if (!ap_isdigit(*addr))
return 0; /* no digit at start of quad */
- ip_addr[quads] = strtol(addr, &tmp, 0);
+ ip_addr[quads] = ap_strtol(addr, &tmp, 0);
if (tmp == addr) /* expected a digit, found something else */
return 0;
@@ -1096,7 +1096,7 @@
++addr;
- bits = strtol(addr, &tmp, 0);
+ bits = ap_strtol(addr, &tmp, 0);
if (tmp == addr) /* expected a digit, found something else */
return 0;
1.48 +4 -4 apache-1.3/src/modules/standard/mod_mime_magic.c
Index: mod_mime_magic.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_mime_magic.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- mod_mime_magic.c 13 Mar 2002 21:05:33 -0000 1.47
+++ mod_mime_magic.c 18 Jun 2002 01:00:00 -0000 1.48
@@ -1110,7 +1110,7 @@
}
/* get offset, then skip over it */
- m->offset = (int) strtol(l, &t, 0);
+ m->offset = (int) ap_strtol(l, &t, 0);
if (l == t) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, serv,
MODNAME ": offset %s invalid", l);
@@ -1145,7 +1145,7 @@
if (*l == '+' || *l == '-')
l++;
if (ap_isdigit((unsigned char) *l)) {
- m->in.offset = strtol(l, &t, 0);
+ m->in.offset = ap_strtol(l, &t, 0);
if (*s == '-')
m->in.offset = -m->in.offset;
}
@@ -1233,7 +1233,7 @@
/* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */
if (*l == '&') {
++l;
- m->mask = signextend(serv, m, strtol(l, &l, 0));
+ m->mask = signextend(serv, m, ap_strtol(l, &l, 0));
}
else
m->mask = ~0L;
@@ -1311,7 +1311,7 @@
m->vallen = slen;
}
else if (m->reln != 'x')
- m->value.l = signextend(s, m, strtol(*p, p, 0));
+ m->value.l = signextend(s, m, ap_strtol(*p, p, 0));
return 0;
}
1.13 +2 -2 apache-1.3/src/modules/test/mod_rndchunk.c
Index: mod_rndchunk.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/test/mod_rndchunk.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- mod_rndchunk.c 13 Mar 2002 21:05:35 -0000 1.12
+++ mod_rndchunk.c 18 Jun 2002 01:00:00 -0000 1.13
@@ -128,12 +128,12 @@
ap_kill_timeout(r);
return 0;
}
- seed = strtol(args, &endptr, 0);
+ seed = ap_strtol(args, &endptr, 0);
if (!endptr || *endptr != ',') {
goto error;
}
++endptr;
- count = strtol(endptr, &endptr, 0);
+ count = ap_strtol(endptr, &endptr, 0);
srandom(seed);
for (i = 0; i < count; ++i) {
1.31 +1 -1 apache-1.3/src/os/win32/mod_isapi.c
Index: mod_isapi.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/os/win32/mod_isapi.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- mod_isapi.c 13 Mar 2002 21:05:36 -0000 1.30
+++ mod_isapi.c 18 Jun 2002 01:00:00 -0000 1.31
@@ -825,7 +825,7 @@
return err;
}
- if (((val = strtol(arg, (char **) &err, 10)) <= 0) || *err)
+ if (((val = ap_strtol(arg, (char **) &err, 10)) <= 0) || *err)
return "ISAPIReadAheadBuffer must be a legitimate value.";
ReadAheadBuffer = val;