Fix core dump on end of group reported by John Kohl, in a different way.

This commit is contained in:
mycroft 1994-11-09 19:30:32 +00:00
parent 1c5ac2e88c
commit 49ebbb080e
1 changed files with 11 additions and 4 deletions

View File

@ -37,7 +37,7 @@
#ifndef lint
/* from: static char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93"; */
static char *rcsid = "$Id: compile.c,v 1.11 1994/04/17 04:19:27 alm Exp $";
static char *rcsid = "$Id: compile.c,v 1.12 1994/11/09 19:30:32 mycroft Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -177,7 +177,6 @@ semicolon: EATSPACE();
cmd->nonsel = cmd->inrange = 0;
/* First parse the addresses */
naddr = 0;
cmd->a1 = cmd->a2 = NULL;
/* Valid characters to start an address */
#define addrchar(c) (strchr("0123456789/\\$", (c)))
@ -192,8 +191,10 @@ semicolon: EATSPACE();
EATSPACE(); /* EXTENSION */
cmd->a2 = xmalloc(sizeof(struct s_addr));
p = compile_addr(p, cmd->a2);
}
}
} else
cmd->a2 = 0;
} else
cmd->a1 = 0;
nonsel: /* Now parse the command */
EATSPACE();
@ -223,6 +224,12 @@ nonsel: /* Now parse the command */
*compile_stream("}", &cmd->u.c, p) = cmd2;
cmd->next = cmd2;
link = &cmd2->next;
/*
* Short-circuit command processing, since end of
* group is really just a noop.
*/
cmd2->nonsel = 1;
cmd2->a1 = cmd2->a2 = 0;
break;
case EMPTY: /* d D g G h H l n N p P q x = \0 */
p++;