summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthib <thib@openbsd.org>2007-01-20 16:52:39 +0000
committerthib <thib@openbsd.org>2007-01-20 16:52:39 +0000
commit2bd60a96db8bf867777fabee0aee9853c9979ce7 (patch)
tree25fd8b1819304dd0208dd5ebddfd9d9bfde9ae96
parentwhen retrying a write, the position was previously not updated. (diff)
downloadwireguard-openbsd-2bd60a96db8bf867777fabee0aee9853c9979ce7.tar.xz
wireguard-openbsd-2bd60a96db8bf867777fabee0aee9853c9979ce7.zip
Add missing check for fgets return value in
cvs_get_repository_name(). OK joris@
-rw-r--r--usr.bin/cvs/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 290284110c2..29cdece4b53 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.100 2007/01/20 01:07:51 niallo Exp $ */
+/* $OpenBSD: util.c,v 1.101 2007/01/20 16:52:39 thib Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -625,7 +625,8 @@ cvs_get_repository_name(const char *dir, char *dst, size_t len)
fatal("cvs_get_repository_name: truncation");
if ((fp = fopen(fpath, "r")) != NULL) {
- fgets(dst, len, fp);
+ if ((fgets(dst, len, fp)) == NULL)
+ fatal("cvs_get_repository_name: bad repository file");
if ((s = strchr(dst, '\n')) != NULL)
*s = '\0';