summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/diff.c
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2008-06-14 04:34:07 +0000
committertobias <tobias@openbsd.org>2008-06-14 04:34:07 +0000
commite28eda4effa88916106caf30548c4250134bc26a (patch)
tree85f1d131bad672421822daa769c2d92cc3f71a5a /usr.bin/cvs/diff.c
parentAdded support for sticky date set in CVS/Tag and CVS/Entries per directory. (diff)
downloadwireguard-openbsd-e28eda4effa88916106caf30548c4250134bc26a.tar.xz
wireguard-openbsd-e28eda4effa88916106caf30548c4250134bc26a.zip
Conforming to RCS specification, it is possible but unlikely to encounter
an RCS file which has no head revision set. Some commands actually can work with them (log, status) so support these files. Fixes A LOT of possible segmentation faults. ok joris
Diffstat (limited to 'usr.bin/cvs/diff.c')
-rw-r--r--usr.bin/cvs/diff.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 5e13804c322..b0e15a3ce6a 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.140 2008/06/11 20:55:34 joris Exp $ */
+/* $OpenBSD: diff.c,v 1.141 2008/06/14 04:34:08 tobias Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -315,6 +315,12 @@ cvs_diff_local(struct cvs_file *cf)
date1 == -1 && date2 == -1)
return;
+ if (cf->file_rcs->rf_head == NULL) {
+ cvs_log(LP_ERR, "no head revision in RCS file for %s\n",
+ cf->file_path);
+ return;
+ }
+
if (kflag && cf->file_rcs != NULL)
rcs_kwexp_set(cf->file_rcs, kflag);