summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2006-03-05 16:34:32 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2006-03-05 16:34:32 +0000
commit62c49de61ea368ae4ac38740b6746db5d9ca921c (patch)
tree0413872b5323a13a995a51f82526a54e26c963cb /usr.bin/cvs
parent5370036c987bf67a9edc99347ca3419134a235e3 (diff)
oops, forgot the diff3.c portion of this diff:
fatal() instead of returning -1 on failure in patch functions ed_patch_lines() and rcs_patch_lines(). this can avoid segfault in certain circumstances. From: Ray Lai <ray@cyth.net> discussed with xsa@ and joris@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/diff3.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c
index f5b722a3839..b6037d29e38 100644
--- a/usr.bin/cvs/diff3.c
+++ b/usr.bin/cvs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.14 2006/02/26 10:07:50 xsa Exp $ */
+/* $OpenBSD: diff3.c,v 1.15 2006/03/05 16:34:31 niallo 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.14 2006/02/26 10:07:50 xsa Exp $";
+ "$OpenBSD: diff3.c,v 1.15 2006/03/05 16:34:31 niallo Exp $";
#endif /* not lint */
#include "includes.h"
@@ -320,17 +320,17 @@ ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines)
if (op == 'a') {
if ((start > dlines->l_nblines) ||
(start < 0) || (*ep != 'a'))
- return (-1);
+ fatal("ed_patch_lines");
} else if (op == 'c') {
if ((start > dlines->l_nblines) ||
(start < 0) || ((*ep != ',') && (*ep != 'c')))
- return (-1);
+ fatal("ed_patch_lines");
if (*ep == ',') {
ep++;
end = (int)strtol(ep, &ep, 10);
if ((end < 0) || (*ep != 'c'))
- return (-1);
+ fatal("ed_patch_lines");
} else {
end = start;
}
@@ -353,7 +353,7 @@ ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines)
}
if (dlp == NULL)
- return (-1);
+ fatal("ed_patch_lines");
if (op == 'c') {
@@ -370,7 +370,7 @@ ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines)
ndlp = lp;
lp = TAILQ_NEXT(lp, l_list);
if (lp == NULL)
- return (-1);
+ fatal("ed_patch_lines");
if (!strcmp(lp->l_line, "."))
break;