diff options
author | 2006-03-05 16:34:31 +0000 | |
---|---|---|
committer | 2006-03-05 16:34:31 +0000 | |
commit | 7c5c0dfe4a299325bd718c0c1393ecc580c72d96 (patch) | |
tree | 71f3b0950d31cefeb6e2650a2cda91f8d345aaa1 /usr.bin/cvs/diff3.c | |
parent | in rcs_patch_lines(), ensure that rcs patch delete operations don't (diff) | |
download | wireguard-openbsd-7c5c0dfe4a299325bd718c0c1393ecc580c72d96.tar.xz wireguard-openbsd-7c5c0dfe4a299325bd718c0c1393ecc580c72d96.zip |
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/diff3.c')
-rw-r--r-- | usr.bin/cvs/diff3.c | 14 |
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; |