From 194b772d8c903750abffe3d4453ff9b0213cd9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 12 May 2020 14:01:10 +0200 Subject: [PATCH] listattr: Make sure attributes are properly terminated * This reduces garbage in the output, especially with 0 byte string types. --- src/bin/listattr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/listattr.cpp b/src/bin/listattr.cpp index 00e0a19aad..ae7d64b3f0 100644 --- a/src/bin/listattr.cpp +++ b/src/bin/listattr.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2015, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2004-2020, Axel Dörfler, axeld@pinc-software.de. * Copyright 2002, Ryan Fleet. * * Distributed under the terms of the MIT license. @@ -76,6 +76,7 @@ show_attr_contents(BNode& node, const char* attribute, const attr_info& info) size); return; } + buffer[min_c(bytesRead, kLimit - 1)] = '\0'; switch (info.type) { case B_INT8_TYPE: