Source-Changes-HG archive

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

[src/trunk]: src/bin/cat fix signed blksize_t lossage.



details:   https://anonhg.NetBSD.org/src/rev/90264e032ec5
branches:  trunk
changeset: 778156:90264e032ec5
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 17 23:35:28 2012 +0000

description:
fix signed blksize_t lossage.

diffstat:

 bin/cat/cat.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 9d5e94766953 -r 90264e032ec5 bin/cat/cat.c
--- a/bin/cat/cat.c     Sat Mar 17 23:22:59 2012 +0000
+++ b/bin/cat/cat.c     Sat Mar 17 23:35:28 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cat.c,v 1.47 2008/07/20 00:52:39 lukem Exp $       */
+/* $NetBSD: cat.c,v 1.48 2012/03/17 23:35:28 christos Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)cat.c      8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: cat.c,v 1.47 2008/07/20 00:52:39 lukem Exp $");
+__RCSID("$NetBSD: cat.c,v 1.48 2012/03/17 23:35:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -295,8 +295,8 @@
        if (buf == NULL) {
                struct stat sbuf;
 
-               if (fstat(wfd, &sbuf) == 0 &&
-                   sbuf.st_blksize > sizeof(fb_buf)) {
+               if (fstat(wfd, &sbuf) == 0 && sbuf.st_blksize > 0 &&
+                   (size_t)sbuf.st_blksize > sizeof(fb_buf)) {
                        bsize = sbuf.st_blksize;
                        buf = malloc(bsize);
                }



Home | Main Index | Thread Index | Old Index