1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Cure size_t abuse, curse some recent code [recommit good bits from r1227852]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1227856 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William A. Rowe Jr
2012-01-05 21:50:31 +00:00
parent 07e32f24db
commit 33d94f3328
3 changed files with 9 additions and 6 deletions

View File

@@ -326,7 +326,7 @@ apr_status_t ajp_msg_append_uint8(ajp_msg_t *msg, apr_byte_t value)
apr_status_t ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value, apr_status_t ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value,
int convert) int convert)
{ {
size_t len; apr_size_t len;
if (value == NULL) { if (value == NULL) {
return(ajp_msg_append_uint16(msg, 0xFFFF)); return(ajp_msg_append_uint16(msg, 0xFFFF));

View File

@@ -522,7 +522,8 @@ APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, request_status,
/* proxy_util.c */ /* proxy_util.c */
PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src, size_t dlen); PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src,
apr_size_t dlen);
PROXY_DECLARE(int) ap_proxy_hex2c(const char *x); PROXY_DECLARE(int) ap_proxy_hex2c(const char *x);
PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x); PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x);
PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t, PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t,

View File

@@ -78,13 +78,15 @@ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, create_req,
(request_rec *r, request_rec *pr), (r, pr), (request_rec *r, request_rec *pr), (r, pr),
OK, DECLINED) OK, DECLINED)
PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src, size_t dlen) PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src,
apr_size_t dlen)
{ {
if ((strlen(src)+1) > dlen) { if ((strlen(src)+1) > dlen) {
/* APR_ENOSPACE would be better */ /* XXX: APR_ENOSPACE would be better */
return APR_EGENERAL; return APR_EGENERAL;
} }
else { else {
/* XXX: Once slen and dlen are known, no excuse not to memcpy */
apr_cpystrn(dst, src, dlen); apr_cpystrn(dst, src, dlen);
} }
return APR_SUCCESS; return APR_SUCCESS;
@@ -921,14 +923,14 @@ PROXY_DECLARE(const char *) ap_proxy_cookie_reverse_map(request_rec *r,
proxy_req_conf *rconf = ap_get_module_config(r->request_config, proxy_req_conf *rconf = ap_get_module_config(r->request_config,
&proxy_module); &proxy_module);
struct proxy_alias *ent; struct proxy_alias *ent;
size_t len = strlen(str); apr_size_t len = strlen(str);
const char *newpath = NULL; const char *newpath = NULL;
const char *newdomain = NULL; const char *newdomain = NULL;
const char *pathp; const char *pathp;
const char *domainp; const char *domainp;
const char *pathe = NULL; const char *pathe = NULL;
const char *domaine = NULL; const char *domaine = NULL;
size_t l1, l2, poffs = 0, doffs = 0; apr_size_t l1, l2, poffs = 0, doffs = 0;
int i; int i;
int ddiff = 0; int ddiff = 0;
int pdiff = 0; int pdiff = 0;