Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/unexpand PR/50750: David Binderman: Check bounds bef...
details: https://anonhg.NetBSD.org/src/rev/66a4618fd240
branches: trunk
changeset: 343426:66a4618fd240
user: christos <christos%NetBSD.org@localhost>
date: Wed Feb 03 05:32:14 2016 +0000
description:
PR/50750: David Binderman: Check bounds before dereference
diffstat:
usr.bin/unexpand/unexpand.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (43 lines):
diff -r fe8c0eccacb6 -r 66a4618fd240 usr.bin/unexpand/unexpand.c
--- a/usr.bin/unexpand/unexpand.c Wed Feb 03 05:29:43 2016 +0000
+++ b/usr.bin/unexpand/unexpand.c Wed Feb 03 05:32:14 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: unexpand.c,v 1.14 2008/12/21 02:33:13 christos Exp $ */
+/* $NetBSD: unexpand.c,v 1.15 2016/02/03 05:32:14 christos Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)unexpand.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: unexpand.c,v 1.14 2008/12/21 02:33:13 christos Exp $");
+__RCSID("$NetBSD: unexpand.c,v 1.15 2016/02/03 05:32:14 christos Exp $");
#endif /* not lint */
/*
@@ -154,8 +154,8 @@
dcol = (1 + dcol / DSTOP) * DSTOP;
continue;
} else {
- for (n = 0; tabstops[n] - 1 < dcol &&
- n < nstops; n++)
+ for (n = 0; n < nstops &&
+ tabstops[n] - 1 < dcol; n++)
continue;
if (n < nstops - 1 && tabstops[n] - 1 < limit) {
dcol = tabstops[n];
@@ -174,10 +174,10 @@
ocol = (1 + ocol / DSTOP) * DSTOP;
}
} else {
- for (n = 0; tabstops[n] <= ocol && n < nstops; n++)
+ for (n = 0; n < nstops && tabstops[n] <= ocol; n++)
continue;
- while (tabstops[n] <= dcol && ocol < dcol &&
- n < nstops && ocol < limit) {
+ while (n < nstops && tabstops[n] <= dcol && ocol < dcol
+ && ocol < limit) {
if (putchar('\t') == EOF)
goto out;
ocol = tabstops[n++];
Home |
Main Index |
Thread Index |
Old Index