sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.
Now it's also valid for sz and bufsz to be equal.
See #3088.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
ul_buffer_append_string(&tmp, _PATH_SYS_DEVBLOCK "/");
ul_buffer_append_data(&tmp, buf, ssz);
- p = ul_buffer_get_data(&tmp, &sz, NULL);
- if (p && sz < bufsz) {
+ p = ul_buffer_get_string(&tmp, &sz, NULL);
+ if (p && sz <= bufsz) {
memcpy(buf, p, sz);
res = buf;
}