listattr: Make sure attributes are properly terminated

* This reduces garbage in the output, especially with 0 byte string
  types.
This commit is contained in:
Axel Dörfler 2020-05-12 14:01:10 +02:00
parent 95e5e933ab
commit 194b772d8c

View File

@ -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: