summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-05-31 02:00:00 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-05-31 02:00:00 +0000
commitdc122fede9d574eae154b39406eae4890806ff5a (patch)
treeb40aceb47eee64ff2dbb51c7cc3be982e6fd1ef8 /usr.bin
parent2fa1743db274de5f3580d24d6a85465eaa2b02f3 (diff)
b1 and b2 can be NULL if an invalid revision is given.
if one of them is NULL, bail out.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/diff.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 635f3838b34..6a538092b80 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.38 2005/05/30 07:28:49 xsa Exp $ */
+/* $OpenBSD: diff.c,v 1.39 2005/05/31 01:59:59 joris Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -638,6 +638,14 @@ cvs_diff_local(CVSFILE *cf, void *arg)
rcsnum_tostr(r1, buf, sizeof(buf)));
b1 = rcs_getrev(rf, r1);
+ if (b1 == NULL) {
+ cvs_log(LP_ERROR, "failed to retrieve revision %s\n",
+ rcsnum_tostr(r1, buf, sizeof(buf)));
+ if (r1 != cf->cf_lrev)
+ rcsnum_free(r1);
+ return (CVS_EX_DATA);
+ }
+
if (r1 != cf->cf_lrev)
rcsnum_free(r1);
@@ -654,6 +662,13 @@ cvs_diff_local(CVSFILE *cf, void *arg)
rcs_close(rf);
+ if (b2 == NULL) {
+ cvs_log(LP_ERROR, "failed to retrieve revision %s\n",
+ dap->rev2);
+ cvs_buf_free(b1);
+ return (CVS_EX_DATA);
+ }
+
printf("%s", diffargs);
printf(" -r%s", buf);
if (dap->rev2 != NULL)