提交 b4ca2999 编写于 作者: D Daniel P. Berrange

Avoid crash if NULL is passed for filename/funcname in logging

The journald code would crash if a NULL was passed for the
filename / funcname in the logging code. This shouldn't
happen in general, but it is better to be safe, since there
have been bugs triggering this.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 cb3868f7
......@@ -1181,9 +1181,11 @@ virLogOutputToJournald(virLogSource source,
journalAddInt(&state, "PRIORITY", priority);
journalAddString(&state, "LIBVIRT_SOURCE",
virLogSourceTypeToString(source));
journalAddString(&state, "CODE_FILE", filename);
if (filename)
journalAddString(&state, "CODE_FILE", filename);
journalAddInt(&state, "CODE_LINE", linenr);
journalAddString(&state, "CODE_FUNC", funcname);
if (funcname)
journalAddString(&state, "CODE_FUNC", funcname);
memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册