summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2007-01-20 16:52:40 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2007-01-20 16:52:40 +0000
commit95bd66722005b7ee4554d45a19a42b088c49e66c (patch)
tree194978364cf07497268236acf4a34b3d1f3f3d24
parent77528926018f660467f175dc5b7b4d1a72be8c83 (diff)
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';