summaryrefslogtreecommitdiff
path: root/games/quiz/rxp.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1999-10-02 06:36:46 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1999-10-02 06:36:46 +0000
commit3f6b495616f3d7adad11e92f69f93b5a96410c22 (patch)
treeae7677b65aad994dcd4ef7de27d734a28620981f /games/quiz/rxp.c
parent871afe20be886117e4eee5b7afa5a145be00578d (diff)
Clean up the string handling to avoid segfaults when the regexp routines
pass each other (char *)NULLs, which used to happen on suitably invalid data files.
Diffstat (limited to 'games/quiz/rxp.c')
-rw-r--r--games/quiz/rxp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/games/quiz/rxp.c b/games/quiz/rxp.c
index 04df2ac5fe5..43da86fe705 100644
--- a/games/quiz/rxp.c
+++ b/games/quiz/rxp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rxp.c,v 1.3 1999/03/27 04:45:26 pjanzen Exp $ */
+/* $OpenBSD: rxp.c,v 1.4 1999/10/02 06:36:45 pjanzen Exp $ */
/* $NetBSD: rxp.c,v 1.5 1995/04/22 10:17:00 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: rxp.c,v 1.3 1999/03/27 04:45:26 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: rxp.c,v 1.4 1999/10/02 06:36:45 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -107,6 +107,11 @@ rxp__compile(s, first)
Rxp_t *alt_ptr;
int esc, err;
+ if (s == NULL) {
+ (void)snprintf(rxperr, sizeof(rxperr),
+ "null string sent to rxp_compile");
+ return(FALSE);
+ }
esc = 0;
if (first) {
rp = rxpbuf;