summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfb <jfb@openbsd.org>2005-04-13 16:25:02 +0000
committerjfb <jfb@openbsd.org>2005-04-13 16:25:02 +0000
commit4cc49e09c3f4ba1c4fd7b8560224f481dc6fdcc4 (patch)
tree1cfa56bf1513407c9fa030c912a2374df0b9222c
parentuse "volatile sig_atomic_t" types instead of "int" for signal flags. (diff)
downloadwireguard-openbsd-4cc49e09c3f4ba1c4fd7b8560224f481dc6fdcc4.tar.xz
wireguard-openbsd-4cc49e09c3f4ba1c4fd7b8560224f481dc6fdcc4.zip
make rcsnum_tostr() return an empty string if the RCSNUM is NULL
-rw-r--r--usr.bin/cvs/rcsnum.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/cvs/rcsnum.c b/usr.bin/cvs/rcsnum.c
index 9dba1f603bf..3388f68aba7 100644
--- a/usr.bin/cvs/rcsnum.c
+++ b/usr.bin/cvs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.9 2005/03/05 05:58:39 jfb Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.10 2005/04/13 16:25:02 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -99,6 +99,10 @@ rcsnum_free(RCSNUM *rn)
/*
* rcsnum_tostr()
+ *
+ * Format the RCS number <nump> into a human-readable dot-separated
+ * representation and store the resulting string in <buf>, which is of size
+ * <blen>.
* Returns a pointer to the start of <buf> on success, or NULL on failure.
*/
char*
@@ -107,7 +111,7 @@ rcsnum_tostr(const RCSNUM *nump, char *buf, size_t blen)
u_int i;
char tmp[8];
- if (nump->rn_len == 0) {
+ if ((nump == NULL) || (nump->rn_len == 0)) {
buf[0] = '\0';
return (buf);
}