diff options
author | 2007-01-20 16:52:39 +0000 | |
---|---|---|
committer | 2007-01-20 16:52:39 +0000 | |
commit | 2bd60a96db8bf867777fabee0aee9853c9979ce7 (patch) | |
tree | 25fd8b1819304dd0208dd5ebddfd9d9bfde9ae96 | |
parent | when retrying a write, the position was previously not updated. (diff) | |
download | wireguard-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.c | 5 |
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'; |