]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/buffer: fix possible SEGV
authorKarel Zak <kzak@redhat.com>
Tue, 22 Mar 2022 11:46:52 +0000 (12:46 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 25 Mar 2022 07:27:52 +0000 (08:27 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/buffer.c

index d1d608ff58482c517bc1189ef2ef9d67693a0175..1dba7dd510c6c796b38b85b27317e92856326b94 100644 (file)
@@ -155,6 +155,9 @@ int ul_buffer_append_data(struct ul_buffer *buf, const char *data, size_t sz)
 
 int ul_buffer_append_string(struct ul_buffer *buf, const char *str)
 {
+       if (!str)
+               return 0;
+
        return ul_buffer_append_data(buf, str, strlen(str));
 }