From 2c310400b1f8dafa3475bfc0efdba14359603c66 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 25 Sep 1999 01:06:04 +0000 Subject: [PATCH] Bugfixes: use -O2, and defend against fgets giving an empty string. --- ipif/Makefile | 3 ++- ipif/service.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ipif/Makefile b/ipif/Makefile index 24d74ad..0d89ae0 100644 --- a/ipif/Makefile +++ b/ipif/Makefile @@ -1,7 +1,8 @@ # +OPTIMISE= -O2 CFLAGS= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith \ - -Wwrite-strings -g -D_GNU_SOURCE + -Wwrite-strings -g $(OPTIMISE) -D_GNU_SOURCE etcdir= /etc prefix= /usr/local diff --git a/ipif/service.c b/ipif/service.c index 0050dd2..18322d4 100644 --- a/ipif/service.c +++ b/ipif/service.c @@ -276,6 +276,7 @@ static void permit(unsigned long pprefix, unsigned long pmask) { int i, any; assert(!(pprefix & ~pmask)); + any= 0; if (!proto) fputs("permits",stdout); if (addrnet_isin(localaddr,~0UL, pprefix,pmask)) { @@ -679,7 +680,7 @@ static void startslattach(void) { } setsigmask(&fullset); l= strlen(ifnbuf); - if (l<0 || ifnbuf[l-1] != '\n') fatal("slattach gave strange output `%s'",ifnbuf); + if (l<=0 || ifnbuf[l-1] != '\n') fatal("slattach gave strange output `%s'",ifnbuf); ifnbuf[l-1]= 0; for (k=l; k>0 && ifnbuf[k-1]!=' '; k--); ifname= ifnbuf+k; -- 2.30.2