From da0e3598d35d5ed45c90f69cd33c70772faa928a Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 1 May 2006 23:00:33 +0000 Subject: Coverity CID 1448: Avoid static array overflow. --- progressbar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/progressbar.c b/progressbar.c index 43b1851..4ee520b 100644 --- a/progressbar.c +++ b/progressbar.c @@ -1,4 +1,4 @@ -/* $NetBSD: progressbar.c,v 1.11 2005/07/19 00:41:05 lukem Exp $ */ +/* $NetBSD: progressbar.c,v 1.12 2006/05/01 23:00:33 christos Exp $ */ /*- * Copyright (c) 1997-2005 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progressbar.c,v 1.11 2005/07/19 00:41:05 lukem Exp $"); +__RCSID("$NetBSD: progressbar.c,v 1.12 2006/05/01 23:00:33 christos Exp $"); #endif /* not lint */ /* @@ -226,6 +226,8 @@ progressmeter(int flag) abbrevsize = cursize; for (i = 0; abbrevsize >= 100000 && i < sizeof(prefixes); i++) abbrevsize >>= 10; + if (i == sizeof(prefixes)) + i--; len += snprintf(buf + len, BUFLEFT, " " LLFP("5") " %c%c ", (LLT)abbrevsize, prefixes[i], -- cgit v1.2.3-56-ge451