Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/hexdump don't read random garbage from the stack



details:   https://anonhg.NetBSD.org/src/rev/8c79e0d912e4
branches:  trunk
changeset: 790635:8c79e0d912e4
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 18 20:19:03 2013 +0000

description:
don't read random garbage from the stack

diffstat:

 usr.bin/hexdump/display.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 86b2cc755d39 -r 8c79e0d912e4 usr.bin/hexdump/display.c
--- a/usr.bin/hexdump/display.c Fri Oct 18 20:18:42 2013 +0000
+++ b/usr.bin/hexdump/display.c Fri Oct 18 20:19:03 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: display.c,v 1.21 2009/01/18 21:34:32 apb Exp $ */
+/*     $NetBSD: display.c,v 1.22 2013/10/18 20:19:03 christos Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)display.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: display.c,v 1.21 2009/01/18 21:34:32 apb Exp $");
+__RCSID("$NetBSD: display.c,v 1.22 2013/10/18 20:19:03 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -344,7 +344,9 @@
                        skip -= sb.st_size;
                        return;
                }
-       }
+       } else
+               sb.st_mode = S_IFIFO;
+
        if (S_ISREG(sb.st_mode)) {
                if (fseek(stdin, skip, SEEK_SET))
                        err(1, "fseek %s", fname);



Home | Main Index | Thread Index | Old Index