Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libsa Use dp->e2d_namlen rather than strlen(dp->e2d_...



details:   https://anonhg.NetBSD.org/src/rev/7cae811c8748
branches:  trunk
changeset: 1006707:7cae811c8748
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Jan 24 13:20:33 2020 +0000

description:
Use dp->e2d_namlen rather than strlen(dp->e2d_name) in ext2fs_ls().

Prevents garbage beyond the end of the name from appearing on screen.

diffstat:

 sys/lib/libsa/ext2fs.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 72aefaa4170c -r 7cae811c8748 sys/lib/libsa/ext2fs.c
--- a/sys/lib/libsa/ext2fs.c    Fri Jan 24 11:44:27 2020 +0000
+++ b/sys/lib/libsa/ext2fs.c    Fri Jan 24 13:20:33 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs.c,v 1.28 2019/06/24 13:58:24 pgoyette Exp $     */
+/*     $NetBSD: ext2fs.c,v 1.29 2020/01/24 13:20:33 jakllsch Exp $     */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -866,7 +866,7 @@
                                goto out;
                        }
                        lsadd(&names, pattern, dp->e2d_name,
-                           strlen(dp->e2d_name), fs2h32(dp->e2d_ino), t);
+                           dp->e2d_namlen, fs2h32(dp->e2d_ino), t);
                }
                fp->f_seekp += buf_size;
        }



Home | Main Index | Thread Index | Old Index