]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/buffer: make sure buffer without data is zero terminated [asan]
authorKarel Zak <kzak@redhat.com>
Fri, 11 Feb 2022 12:00:05 +0000 (13:00 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 11 Feb 2022 12:00:05 +0000 (13:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/buffer.c

index 4cd9fcf65c68957eee2378df1c7222b310120c74..d1d608ff58482c517bc1189ef2ef9d67693a0175 100644 (file)
@@ -122,6 +122,8 @@ int ul_buffer_alloc_data(struct ul_buffer *buf, size_t sz)
        buf->end = buf->begin + len;
        buf->sz = sz;
 
+       memset(buf->end, '\0', sz - len);
+
        return 0;
 }