Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time CID 1060853: Negative array index read (REVERS...



details:   https://anonhg.NetBSD.org/src/rev/53982f4333ad
branches:  trunk
changeset: 789072:53982f4333ad
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 06 05:48:39 2013 +0000

description:
CID 1060853: Negative array index read (REVERSE_NEGATIVE)

diffstat:

 lib/libc/time/zic.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 5249443bb547 -r 53982f4333ad lib/libc/time/zic.c
--- a/lib/libc/time/zic.c       Tue Aug 06 05:47:58 2013 +0000
+++ b/lib/libc/time/zic.c       Tue Aug 06 05:48:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zic.c,v 1.41 2013/07/17 20:13:04 christos Exp $        */
+/*     $NetBSD: zic.c,v 1.42 2013/08/06 05:48:39 christos Exp $        */
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.41 2013/07/17 20:13:04 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.42 2013/08/06 05:48:39 christos Exp $");
 #endif /* !defined lint */
 
 #include "version.h"
@@ -1572,10 +1572,13 @@
                        int     mrudst, mrustd, hidst, histd, type;
 
                        hidst = histd = mrudst = mrustd = -1;
-                       for (i = thistimei; i < thistimelim; ++i)
+                       for (i = thistimei; i < thistimelim; ++i) {
+                               if (i < 0)
+                                       continue;
                                if (isdsts[types[i]])
                                        mrudst = types[i];
                                else    mrustd = types[i];
+                       }
                        for (i = 0; i < typecnt; ++i)
                                if (writetype[i]) {
                                        if (isdsts[i])



Home | Main Index | Thread Index | Old Index