summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2003-09-25 02:06:40 +0000
committertedu <tedu@openbsd.org>2003-09-25 02:06:40 +0000
commitbcc7d7a8f57bf41b2e71c2e94b12ad984404d496 (patch)
tree1ec857212c5923d651ecd5ffa9654a21a0bdb858
parentcleanup privsep communications between child/parent with a lot more (diff)
downloadwireguard-openbsd-bcc7d7a8f57bf41b2e71c2e94b12ad984404d496.tar.xz
wireguard-openbsd-bcc7d7a8f57bf41b2e71c2e94b12ad984404d496.zip
don't run out of bounds. fixes david's crash during regress.
ok david deraadt millert
-rw-r--r--usr.bin/sort/fields.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/sort/fields.c b/usr.bin/sort/fields.c
index ece7618fff1..e6ebcda8d4f 100644
--- a/usr.bin/sort/fields.c
+++ b/usr.bin/sort/fields.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fields.c,v 1.8 2003/06/10 22:20:51 deraadt Exp $ */
+/* $OpenBSD: fields.c,v 1.9 2003/09/25 02:06:40 tedu Exp $ */
/*-
* Copyright (c) 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)fields.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: fields.c,v 1.8 2003/06/10 22:20:51 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: fields.c,v 1.9 2003/09/25 02:06:40 tedu Exp $";
#endif
#endif /* not lint */
@@ -51,8 +51,8 @@ static char rcsid[] = "$OpenBSD: fields.c,v 1.8 2003/06/10 22:20:51 deraadt Exp
#define NEXTCOL(pos) { \
if (!SEP_FLAG) \
- while (BLANK & l_d_mask[*(++pos)]); \
- while (!((FLD_D | REC_D_F) & l_d_mask[*++pos])); \
+ while (pos < lineend && BLANK & l_d_mask[*(++pos)]); \
+ while (pos < lineend && !((FLD_D | REC_D_F) & l_d_mask[*++pos])); \
}
extern u_char *enterfield(u_char *, u_char *, struct field *, int);