mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05: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:
@@ -135,6 +135,8 @@ virSystemdAppendValidMachineName(virBufferPtr buf,
|
||||
bool skip_dot = false;
|
||||
|
||||
for (; *name; name++) {
|
||||
if (virBufferError(buf))
|
||||
break;
|
||||
if (strlen(virBufferCurrentContent(buf)) >= 64)
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user