From a1b79960d99297510a8abae0e45691a242bc5463 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Thu, 7 Jul 2005 14:08:42 +0000 Subject: snprintf(3) checks. ok xsa@ --- usr.bin/cvs/status.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'usr.bin/cvs/status.c') 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 * 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) { -- cgit v1.2.3