diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-04-13 16:25:03 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-04-13 16:25:03 +0000 |
commit | a9ae0faa5c05e79864419feb51de3737e5f00ec3 (patch) | |
tree | c7ef7083dbbf9d822b2828ff4b19f924b7b1d34a /usr.bin/cvs/rcsnum.c | |
parent | 36f62af29d7802c14d4984c28e17020e8241757a (diff) |
make rcsnum_tostr() return an empty string if the RCSNUM is NULL
Diffstat (limited to 'usr.bin/cvs/rcsnum.c')
-rw-r--r-- | usr.bin/cvs/rcsnum.c | 8 |
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); } |