Source-Changes-HG archive

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

[src/netbsd-1-6]: src/usr.bin/sed Pullup rev 1.34 (requested by itojun in tic...



details:   https://anonhg.NetBSD.org/src/rev/cb178428004a
branches:  netbsd-1-6
changeset: 531098:cb178428004a
user:      jmc <jmc%NetBSD.org@localhost>
date:      Fri Mar 12 05:57:45 2004 +0000

description:
Pullup rev 1.34 (requested by itojun in ticket #1558)

Prevent integer underflow.

diffstat:

 usr.bin/sed/process.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 7e3874dd2843 -r cb178428004a usr.bin/sed/process.c
--- a/usr.bin/sed/process.c     Fri Mar 12 05:56:01 2004 +0000
+++ b/usr.bin/sed/process.c     Fri Mar 12 05:57:45 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process.c,v 1.30 2001/10/02 03:03:02 atatat Exp $      */
+/*     $NetBSD: process.c,v 1.30.2.1 2004/03/12 05:57:45 jmc Exp $     */
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)process.c  8.6 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: process.c,v 1.30 2001/10/02 03:03:02 atatat Exp $");
+__RCSID("$NetBSD: process.c,v 1.30.2.1 2004/03/12 05:57:45 jmc Exp $");
 #endif
 #endif /* not lint */
 
@@ -570,7 +570,7 @@
        char c, *dst;
 
 #define        NEEDSP(reqlen)                                                  \
-       if (sp->len >= sp->blen - (reqlen) - 1) {                       \
+       if (sp->len + (reqlen) + 1 >= sp->blen) {                       \
                sp->blen += (reqlen) + 1024;                            \
                sp->space = sp->back = xrealloc(sp->back, sp->blen);    \
                dst = sp->space + sp->len;                              \



Home | Main Index | Thread Index | Old Index