mirror of https://gitee.com/openkylin/libvirt.git
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;
|
||||
|
||||
for (; *name; name++) {
|
||||
if (virBufferError(buf))
|
||||
break;
|
||||
if (strlen(virBufferCurrentContent(buf)) >= 64)
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue