diff options
Diffstat (limited to 'lib/libcompat/regexp/regexp.c')
-rw-r--r-- | lib/libcompat/regexp/regexp.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/libcompat/regexp/regexp.c b/lib/libcompat/regexp/regexp.c index e473c53a9d3..b1e3b965248 100644 --- a/lib/libcompat/regexp/regexp.c +++ b/lib/libcompat/regexp/regexp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regexp.c,v 1.3 2002/02/16 21:27:26 millert Exp $ */ +/* $OpenBSD: regexp.c,v 1.4 2003/03/16 03:16:45 deraadt Exp $ */ /* * regcomp and regexec -- regsub and regerror are elsewhere @@ -36,7 +36,7 @@ */ #ifndef lint -static char *rcsid = "$OpenBSD: regexp.c,v 1.3 2002/02/16 21:27:26 millert Exp $"; +static char *rcsid = "$OpenBSD: regexp.c,v 1.4 2003/03/16 03:16:45 deraadt Exp $"; #endif /* not lint */ #include <regexp.h> @@ -1208,11 +1208,9 @@ static char * regprop(op) char *op; { - register char *p; + register char *p = NULL; static char buf[50]; - (void) strcpy(buf, ":"); - switch (OP(op)) { case BOL: p = "BOL"; @@ -1253,8 +1251,7 @@ char *op; case OPEN+7: case OPEN+8: case OPEN+9: - sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); - p = NULL; + snprintf(buf, sizeof buf, ":OPEN%d", OP(op)-OPEN); break; case CLOSE+1: case CLOSE+2: @@ -1265,8 +1262,7 @@ char *op; case CLOSE+7: case CLOSE+8: case CLOSE+9: - sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); - p = NULL; + snprintf(buf, sizeof buf, ":CLOSE%d", OP(op)-CLOSE); break; case STAR: p = "STAR"; @@ -1282,10 +1278,11 @@ char *op; break; default: v8_regerror("corrupted opcode"); + p = "ERROR"; break; } if (p != NULL) - (void) strcat(buf, p); + (void) snprintf(buf, sizeof buf, ":%s", p); return(buf); } #endif |