diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-07-07 14:08:42 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-07-07 14:08:42 +0000 |
commit | a1b79960d99297510a8abae0e45691a242bc5463 (patch) | |
tree | ff79b7fbc973815079a4b337ed83b901c7403c4e /usr.bin/cvs/status.c | |
parent | 7fb8ce57ff92606e4fc3d1714e5b4cc37d574ae0 (diff) |
snprintf(3) checks.
ok xsa@
Diffstat (limited to 'usr.bin/cvs/status.c')
-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) { |