diff options
author | 2005-07-07 14:08:41 +0000 | |
---|---|---|
committer | 2005-07-07 14:08:41 +0000 | |
commit | 42d9518a939fc2c289ff85916d5750bac7f0709d (patch) | |
tree | 3933f728e8bc564f005e7d29f11ec3625f40995a | |
parent | Expunge two unused fields (buf_size, timeout) in tree_cache structure. (diff) | |
download | wireguard-openbsd-42d9518a939fc2c289ff85916d5750bac7f0709d.tar.xz wireguard-openbsd-42d9518a939fc2c289ff85916d5750bac7f0709d.zip |
snprintf(3) checks.
ok xsa@
-rw-r--r-- | usr.bin/cvs/status.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 9b4f2218a85..ab22b946251 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.31 2005/07/07 07:37:43 xsa Exp $ */ +/* $OpenBSD: status.c,v 1.32 2005/07/07 14:08:41 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -213,12 +213,16 @@ cvs_status_local(CVSFILE *cf, void *arg) buf, cvs_statstr[cf->cf_cvstat]); if (cf->cf_cvstat == CVS_FST_UNKNOWN) { - snprintf(buf, sizeof(buf), "No entry for %s", cf->cf_name); + len = snprintf(buf, sizeof(buf), "No entry for %s", + cf->cf_name); } else { - snprintf(buf, sizeof(buf), "%s", + len = snprintf(buf, sizeof(buf), "%s", rcsnum_tostr(cf->cf_lrev, buf, sizeof(buf))); } + if (len == -1 || len >= (int)sizeof(len)) + return (CVS_EX_DATA); + cvs_printf(" Working revision:\t%s\n", buf); if (cf->cf_cvstat == CVS_FST_UNKNOWN) { |