libsmartcols: make buffers append function more robust
Fixes: https://github.com/karelzak/util-linux/issues/1279 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
91f6895fff
commit
aac716f503
|
@ -56,6 +56,8 @@ int buffer_append_data(struct libscols_buffer *buf, const char *str)
|
|||
return -EINVAL;
|
||||
if (!str || !*str)
|
||||
return 0;
|
||||
if (!buf->cur || !buf->begin)
|
||||
return -EINVAL;
|
||||
|
||||
sz = strlen(str);
|
||||
maxsz = buf->bufsz - (buf->cur - buf->begin);
|
||||
|
|
Loading…
Reference in New Issue