Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/gzip set errno on overflow return.



details:   https://anonhg.NetBSD.org/src/rev/5b68b105ee6e
branches:  trunk
changeset: 768382:5b68b105ee6e
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 16 03:25:34 2011 +0000

description:
set errno on overflow return.

diffstat:

 usr.bin/gzip/zuncompress.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r d86280568215 -r 5b68b105ee6e usr.bin/gzip/zuncompress.c
--- a/usr.bin/gzip/zuncompress.c        Tue Aug 16 03:24:47 2011 +0000
+++ b/usr.bin/gzip/zuncompress.c        Tue Aug 16 03:25:34 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zuncompress.c,v 1.9 2011/08/16 03:21:47 christos Exp $ */
+/*     $NetBSD: zuncompress.c,v 1.10 2011/08/16 03:25:34 christos Exp $ */
 
 /*-
  * Copyright (c) 1985, 1986, 1992, 1993
@@ -288,8 +288,10 @@
 
                /* Generate output characters in reverse order. */
                while (zs->u.r.zs_code >= 256) {
-                       if (zs->u.r.zs_stackp - de_stack >= HSIZE - 1)
+                       if (zs->u.r.zs_stackp - de_stack >= HSIZE - 1) {
+                               errno = EOVERFLOW;
                                return -1;
+                       }
                        *zs->u.r.zs_stackp++ = tab_suffixof(zs->u.r.zs_code);
                        zs->u.r.zs_code = tab_prefixof(zs->u.r.zs_code);
                }



Home | Main Index | Thread Index | Old Index