diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-10-24 06:22:54 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-10-24 06:22:54 +0000 |
commit | a60457e2d398cf41236f7c890db3225b4e923432 (patch) | |
tree | 235e0d2874f9984f4ded12a8d53ed2c733cc5e39 /usr.bin/rcs | |
parent | dfec78c060b98b43a0e3ae824c5c6b7bcc10c98e (diff) |
Check that string length != 0 before setting buf[strlen(buf) - 1].
OK xsa@.
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r-- | usr.bin/rcs/diff3.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c index 3ac29f5b6f8..99d618e83c1 100644 --- a/usr.bin/rcs/diff3.c +++ b/usr.bin/rcs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.15 2006/09/21 15:30:07 millert Exp $ */ +/* $OpenBSD: diff3.c,v 1.16 2006/10/24 06:22:53 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -72,7 +72,7 @@ static const char copyright[] = #ifndef lint static const char rcsid[] = - "$OpenBSD: diff3.c,v 1.15 2006/09/21 15:30:07 millert Exp $"; + "$OpenBSD: diff3.c,v 1.16 2006/10/24 06:22:53 ray Exp $"; #endif /* not lint */ #include "includes.h" @@ -427,6 +427,8 @@ ed_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines) end = 0; for (lp = TAILQ_NEXT(lp, l_list); lp != NULL; lp = TAILQ_NEXT(lp, l_list)) { + if (lp->l_line[0] == '\0') + errx(1, "ed_patch_lines"); op = lp->l_line[strlen(lp->l_line) - 1]; start = (int)strtol(lp->l_line, &ep, 10); if (op == 'a') { |