mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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.
This commit is contained in:
parent
1b1b045915
commit
c5ca209f58
@ -135,6 +135,8 @@ virSystemdAppendValidMachineName(virBufferPtr buf,
|
|||||||
bool skip_dot = false;
|
bool skip_dot = false;
|
||||||
|
|
||||||
for (; *name; name++) {
|
for (; *name; name++) {
|
||||||
|
if (virBufferError(buf))
|
||||||
|
break;
|
||||||
if (strlen(virBufferCurrentContent(buf)) >= 64)
|
if (strlen(virBufferCurrentContent(buf)) >= 64)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user