dgaudet 98/01/19 17:42:24
Modified: src/main util.c
Log:
One of Marc's security patches that's in 1.2.5 but not 1.3.
Submitted by: Marc Slemko
Reviewed by: Dean Gaudet
Revision Changes Path
1.87 +6 -1 apachen/src/main/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- util.c 1998/01/19 15:08:39 1.86
+++ util.c 1998/01/20 01:42:23 1.87
@@ -779,6 +779,11 @@
if (c == EOF)
return 1;
+
+ if(bufsize < 2) {
+ /* too small, assume caller is crazy */
+ return 1;
+ }
while (1) {
if ((c == '\t') || (c == ' ')) {
@@ -793,7 +798,7 @@
/* increase line number and return on LF */
++cfp->line_number;
}
- if (c == EOF || c == 0x4 || c == LF || i == (bufsize - 1)) {
+ if (c == EOF || c == 0x4 || c == LF || i >= (bufsize - 2)) {
/* blast trailing whitespace */
while (i > 0 && isspace(buf[i - 1]))
--i;