From e28eda4effa88916106caf30548c4250134bc26a Mon Sep 17 00:00:00 2001 From: tobias Date: Sat, 14 Jun 2008 04:34:07 +0000 Subject: 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 --- usr.bin/cvs/diff.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'usr.bin/cvs/diff.c') 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 * Copyright (c) 2006 Joris Vink @@ -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); -- cgit v1.2.3-59-g8ed1b