Fix several out of bounds accesses.

Parts from Wolfgang S. Rupprecht via PR 4175; testing by Sam Smith.
This commit is contained in:
naddy 2005-04-18 22:32:36 +00:00
parent 470be3178b
commit da0859a09c
5 changed files with 68 additions and 11 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.40 2004/12/11 13:29:21 alek Exp $
# $OpenBSD: Makefile,v 1.41 2005/04/18 22:32:36 naddy Exp $
COMMENT= "extremely fast program for analysing WWW logfiles"
DISTNAME= analog-5.32
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= www
MASTER_SITES= http://www.analog.cx/ \

View File

@ -1,9 +1,10 @@
$OpenBSD: patch-src_Makefile,v 1.2 2001/11/22 11:10:39 form Exp $
--- src/Makefile.orig Thu Nov 22 17:06:08 2001
+++ src/Makefile Thu Nov 22 17:07:16 2001
@@ -1,9 +1,9 @@
# Makefile for analog 5.1
$OpenBSD: patch-src_Makefile,v 1.3 2005/04/18 22:32:36 naddy Exp $
--- src/Makefile.orig Sun Mar 23 14:57:02 2003
+++ src/Makefile Mon Apr 18 21:42:20 2005
@@ -2,10 +2,10 @@
# Please read docs/Readme.html, or http://www.analog.cx/
# This is a general Unix-like Makefile: Makefiles for other OS's can be found
# in the "build" directory.
-CC = gcc # which compiler to use: eg cc, acc, gcc. NB Different
+#CC = gcc # which compiler to use: eg cc, acc, gcc. NB Different
# compilers need different CFLAGS, e.g., -O instead of -O2.
@ -13,16 +14,16 @@ $OpenBSD: patch-src_Makefile,v 1.2 2001/11/22 11:10:39 form Exp $
# HP/UX cc needs CFLAGS = -Aa (HP/UX 9) or -Ae (HP/UX 10)
# BeOS needs CFLAGS = -O2 -Wl,-L/boot/home/config/lib
# BS2000/OSD needs CFLAGS = -XLLML -XLLMK
@@ -56,7 +56,7 @@ HEADERS = anlghead.h anlghea2.h anlghea3
@@ -66,7 +66,7 @@ HEADERS = anlghead.h anlghea2.h anlghea3
ALLCFLAGS = $(CFLAGS) $(DEFS) -D$(OS)
ALLOBJS = $(OBJS) $(SUBDIROBJS)
-$(PROGRAM): $(OBJS) $(SUBDIRS) $(HEADERS) Makefile
+$(PROGRAM): $(OBJS) $(SUBDIRS) $(HEADERS)
$(CC) $(CFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS)
@echo '***'
@echo '***IMPORTANT: You must read the licence before using analog'
@@ -76,61 +76,61 @@ pcre: ALWAYS
@echo "***"
@echo "***IMPORTANT: You must read the licence before using analog"
@@ -86,61 +86,61 @@ pcre: ALWAYS
zlib: ALWAYS
cd zlib && $(MAKE) 'CC=$(CC)' 'ALLCFLAGS=$(ALLCFLAGS)'

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-src_init2_c,v 1.1 2005/04/18 22:32:36 naddy Exp $
--- src/init2.c.orig Sun Mar 23 14:57:02 2003
+++ src/init2.c Mon Apr 18 21:42:41 2005
@@ -244,10 +244,10 @@ void configchoice(void *opt, char *cmd,
return;
}
- if (STREQ(cmdend - 6, "SORTBY"))
+ if ((cmd <= (cmdend - 6)) && STREQ(cmdend - 6, "SORTBY"))
choices = sortbychoices;
#ifndef NOGRAPHICS
- else if (STREQ(cmdend - 5, "CHART"))
+ else if ((cmd <= (cmdend - 5)) && STREQ(cmdend - 5, "CHART"))
choices = chartchoices;
#endif
else if (STREQ(cmd, "OUTPUT"))
@@ -260,7 +260,7 @@ void configchoice(void *opt, char *cmd,
choices = langchoices;
else if (STREQ(cmd, "GOTOS"))
choices = gotochoices;
- else if (STREQ(cmdend - 4, "CASE")) {
+ else if ((cmd <= (cmdend - 4)) && STREQ(cmdend - 4, "CASE")) {
choices = casechoices;
islog = TRUE;
}

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-src_init_c,v 1.1 2005/04/18 22:32:36 naddy Exp $
--- src/init.c.orig Mon Apr 18 22:47:03 2005
+++ src/init.c Mon Apr 18 22:47:31 2005
@@ -1435,7 +1435,6 @@ choice strtoinfmt(Inputformat **ans, cha
c++;
if (*c == 'S')
done = TRUE;
- c++;
}
}
if (!done) {
@@ -1446,7 +1445,6 @@ choice strtoinfmt(Inputformat **ans, cha
c++;
if (*c == 's')
*c = 'S';
- c++;
}
}
}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_utils_c,v 1.1 2005/04/18 22:32:36 naddy Exp $
--- src/utils.c.orig Mon Apr 18 21:48:29 2005
+++ src/utils.c Mon Apr 18 21:48:56 2005
@@ -690,7 +690,7 @@ logical wildmatch(char *s, char *p, char
below. */
ss = strchr(s, '\0');
pp = strchr(p, '\0');
- while ((*ss == *pp || *pp == '?') && ss >= s && *pp != '*') {
+ while (ss >= s && *pp != '*' && (*ss == *pp || *pp == '?')) {
ss--; /* pp != p is covered because *p == '*' */
pp--;
}