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/commit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.bin/cvs/commit.c') diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index ecfdf49741b..1d3c34dd8b5 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.141 2008/06/14 03:19:15 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.142 2008/06/14 04:34:08 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria @@ -472,8 +472,8 @@ cvs_commit_local(struct cvs_file *cf) rrev = rcs_head_get(cf->file_rcs); crev = rcs_head_get(cf->file_rcs); if (crev == NULL || rrev == NULL) - fatal("RCS head empty or missing in %s\n", - cf->file_rcs->rf_path); + fatal("no head revision in RCS file for %s", + cf->file_path); tag = cvs_directory_tag; if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL) @@ -571,6 +571,9 @@ cvs_commit_local(struct cvs_file *cf) cvs_printf("old revision: %s; ", rbuf); } + if (isnew == 0 && cf->file_rcs->rf_head == NULL) + fatal("no head revision in RCS file for %s", cf->file_path); + if (isnew == 0 && onbranch == 0) d = commit_diff(cf, cf->file_rcs->rf_head, 0); -- cgit v1.2.3-59-g8ed1b