summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/commit.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/commit.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/commit.c')
-rw-r--r--usr.bin/cvs/commit.c9
1 files changed, 6 insertions, 3 deletions
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 <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -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);