提交 c5ca209f 编写于 作者: W Wang King 提交者: Peter Krempa

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.
上级 1b1b0459
......@@ -135,6 +135,8 @@ virSystemdAppendValidMachineName(virBufferPtr buf,
bool skip_dot = false;
for (; *name; name++) {
if (virBufferError(buf))
break;
if (strlen(virBufferCurrentContent(buf)) >= 64)
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册