Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/gencat fix possible 1-byte overflow.



details:   https://anonhg.NetBSD.org/src/rev/073b47f5f12f
branches:  trunk
changeset: 515247:073b47f5f12f
user:      yamt <yamt%NetBSD.org@localhost>
date:      Thu Sep 20 15:56:06 2001 +0000

description:
fix possible 1-byte overflow.

diffstat:

 usr.bin/gencat/gencat.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 3aa6e5fdcaa8 -r 073b47f5f12f usr.bin/gencat/gencat.c
--- a/usr.bin/gencat/gencat.c   Thu Sep 20 13:54:43 2001 +0000
+++ b/usr.bin/gencat/gencat.c   Thu Sep 20 15:56:06 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gencat.c,v 1.10 2001/02/19 23:03:47 cgd Exp $  */
+/*     $NetBSD: gencat.c,v 1.11 2001/09/20 15:56:06 yamt Exp $ */
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: gencat.c,v 1.10 2001/02/19 23:03:47 cgd Exp $");
+__RCSID("$NetBSD: gencat.c,v 1.11 2001/09/20 15:56:06 yamt Exp $");
 #endif
 
 /***********************************************************
@@ -269,6 +269,10 @@
                        } else
                                *cptr = *bptr;
                }
+               if (cptr == cend) {
+                       cptr = curline = xrealloc(curline, curlen *= 2);
+                       cend = curline + curlen;
+               }
                if (bptr == bend) {
                        buflen = read(fd, buf, BUFSIZ);
                        if (buflen <= 0) {
@@ -281,10 +285,6 @@
                        bend = buf + buflen;
                        bptr = buf;
                }
-               if (cptr == cend) {
-                       cptr = curline = xrealloc(curline, curlen *= 2);
-                       cend = curline + curlen;
-               }
        }
 }
 



Home | Main Index | Thread Index | Old Index