mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
util: systemd: Don't strlen a possibly NULL string
Coverity complains about virBufferCurrentContent might be return null
when calling strlen, so check virBufferError first before calling
strlen.
(cherry picked from commit c5ca209f58
)
This commit is contained in:
parent
a7aacb742e
commit
679aa1901d
@ -135,6 +135,8 @@ virSystemdAppendValidMachineName(virBufferPtr buf,
|
||||
bool skip_dot = false;
|
||||
|
||||
for (; *name; name++) {
|
||||
if (virBufferError(buf))
|
||||
break;
|
||||
if (strlen(virBufferCurrentContent(buf)) >= 64)
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user