diff options
author | 2005-05-31 01:59:59 +0000 | |
---|---|---|
committer | 2005-05-31 01:59:59 +0000 | |
commit | 95ae1173efc0f738823268ce7621e4b7e56f0dbe (patch) | |
tree | 7245ec80ff68b31718c57b069199040bbf9215bf /usr.bin/cvs/diff.c | |
parent | Remove unused sc_err1() parameter 'async'. Lint. (diff) | |
download | wireguard-openbsd-95ae1173efc0f738823268ce7621e4b7e56f0dbe.tar.xz wireguard-openbsd-95ae1173efc0f738823268ce7621e4b7e56f0dbe.zip |
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/cvs/diff.c')
-rw-r--r-- | usr.bin/cvs/diff.c | 17 |
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) |