dgaudet 97/12/30 11:55:50
Modified: src/main util.c
Log:
Fix some off-by-1s, and do some strength reduction from ap_cpystrn to memcpy.
Revision Changes Path
1.81 +6 -9 apachen/src/main/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- util.c 1997/12/30 19:03:18 1.80
+++ util.c 1997/12/30 19:55:48 1.81
@@ -287,11 +287,8 @@
}
else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
len = pmatch[no].rm_eo - pmatch[no].rm_so;
- ap_cpystrn(dst, source + pmatch[no].rm_so, len);
+ memcpy(dst, source + pmatch[no].rm_so, len);
dst += len;
- /* is this still valid? jj 12/26/97 */
- if (*(dst - 1) == '\0') /* ap_cpystrn hit NULL. */
- return NULL;
}
}
@@ -447,7 +444,7 @@
if (s[x] == '/')
if ((++f) == n) {
res = palloc(p, x + 2);
- ap_cpystrn(res, s, x);
+ memcpy(res, s, x);
res[x] = '/';
res[x + 1] = '\0';
return res;
@@ -506,7 +503,7 @@
}
res = palloc(atrans, pos + 1);
- ap_cpystrn(res, *line, pos);
+ ap_cpystrn(res, *line, pos + 1);
while ((*line)[pos] == stop)
++pos;
@@ -540,7 +537,7 @@
}
res = palloc(atrans, pos + 1);
- ap_cpystrn(res, *line, pos);
+ ap_cpystrn(res, *line, pos + 1);
while (isspace((*line)[pos]))
++pos;
@@ -567,7 +564,7 @@
}
res = palloc(atrans, pos + 1);
- ap_cpystrn(res, *line, pos);
+ ap_cpystrn(res, *line, pos + 1);
++pos;
@@ -850,7 +847,7 @@
tok_len = ptr - tok_start;
token = palloc(p, tok_len + 1);
- ap_cpystrn(token, tok_start, tok_len);
+ ap_cpystrn(token, tok_start, tok_len + 1);
/* Advance accept_line pointer to the next non-white byte */