dgaudet 97/12/22 17:50:03
Modified: . STATUS
src CHANGES
src/modules/standard mod_autoindex.c
Log:
"AddIconByType (TXT,/icons/text.gif text/*", note the missing closing
paren, does the wrong thing, and doesn't report an error.
Don't fread() without testing for errors.
Reviewed by: Jim Jagielski, Martin Kraemer
Revision Changes Path
1.16 +1 -4 apachen/STATUS
Index: STATUS
===================================================================
RCS file: /export/home/cvs/apachen/STATUS,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- STATUS 1997/12/22 21:52:59 1.15
+++ STATUS 1997/12/23 01:49:58 1.16
@@ -48,6 +48,7 @@
* Dean's [PATCH] Re: problem with a .gif and v2.1.4
* Dean's [PATCH] util_date.c needless reinitialization
* Martin's [PATCH] Gimme a break! (missing break;s in mod_include)
+ * Dean's [PATCH] two bugs in mod_autoindex
Available:
@@ -58,10 +59,6 @@
* Dean's [PATCH] Re: [BUGFIXES] Wrong GID for PID file and UMASK for logs
<[EMAIL PROTECTED]>
Status: Dean +1, Martin +1
-
- * Dean's [PATCH] two bugs in mod_autoindex
- <[EMAIL PROTECTED]>
- Status: Dean +1, Randy +1, Martin +1
* Dean's [PATCH] fix Rasmus' chunking error
<[EMAIL PROTECTED]>
1.536 +4 -0 apachen/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.535
retrieving revision 1.536
diff -u -r1.535 -r1.536
--- CHANGES 1997/12/21 08:18:14 1.535
+++ CHANGES 1997/12/23 01:50:00 1.536
@@ -1,4 +1,8 @@
Changes with Apache 1.3b4
+
+ *) mod_autoindex had an fread() without checking the result code.
+ It also wouldn't handle "AddIconByType (TXT,/icons/text.gif text/*"
+ (note the missing closing paren) properly. [Dean Gaudet]
*) It appears the "257th byte" bug (see
htdocs/manual/misc/known_client_problems.html#257th-byte) can happen
1.60 +12 -2 apachen/src/modules/standard/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- mod_autoindex.c 1997/12/18 19:55:17 1.59
+++ mod_autoindex.c 1997/12/23 01:50:02 1.60
@@ -186,8 +186,14 @@
char *iconbak = pstrdup(cmd->pool, icon);
if (icon[0] == '(') {
- char *alt = getword_nc(cmd->pool, &iconbak, ',');
- iconbak[strlen(iconbak) - 1] = '\0'; /* Lose closing paren */
+ char *alt;
+ char *cl = strchr(iconbak, ')');
+
+ if (cl == NULL) {
+ return "missing closing paren";
+ }
+ alt = getword_nc(cmd->pool, &iconbak, ',');
+ *cl = '\0'; /* Lose closing paren */
add_alt(cmd, d, &alt[1], to);
}
if (cmd->info == BY_PATH)
@@ -612,6 +618,10 @@
if (!(thefile = pfopen(r->pool, r->filename, "r")))
return NULL;
n = fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
+ if (n <= 0) {
+ pfclose(r->pool, thefile);
+ return NULL;
+ }
titlebuf[n] = '\0';
for (x = 0, p = 0; titlebuf[x]; x++) {
if (toupper(titlebuf[x]) == find[p]) {