Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/extattr Fix off-by-one in hexdump display (getextatt...



details:   https://anonhg.NetBSD.org/src/rev/383e39e17e16
branches:  trunk
changeset: 779769:383e39e17e16
user:      manu <manu%NetBSD.org@localhost>
date:      Sun Jun 17 08:09:29 2012 +0000

description:
Fix off-by-one in hexdump display (getextattr -x), which displayed a
trailing garbage byte.

diffstat:

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

diffs (26 lines):

diff -r afeb852a70fe -r 383e39e17e16 usr.bin/extattr/getextattr.c
--- a/usr.bin/extattr/getextattr.c      Sun Jun 17 07:40:25 2012 +0000
+++ b/usr.bin/extattr/getextattr.c      Sun Jun 17 08:09:29 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getextattr.c,v 1.9 2011/09/16 15:39:25 joerg Exp $     */
+/*     $NetBSD: getextattr.c,v 1.10 2012/06/17 08:09:29 manu Exp $     */
 
 /*-
  * Copyright (c) 2002, 2003 Networks Associates Technology, Inc.
@@ -143,14 +143,14 @@
        for (i = 0; i < len; i += 16) {
                printf("   %03x   ", i);
                for (j = 0; j < 16; j++) {
-                       if (i + j > len)
+                       if (i + j >= len)
                                printf("   ");
                        else
                                printf("%02x ", addr[i + j] & 0xff);
                }
                printf("   ");
                for (j = 0; j < 16; j++) {
-                       if (i + j > len)
+                       if (i + j >= len)
                                printf(" ");
                        else
                                printf("%c", HEXDUMP_PRINT(addr[i + j]));



Home | Main Index | Thread Index | Old Index