提交 2d0243f4 编写于 作者: J John Ferlan

storage: Resolve Coverity FORWARD_NULL

Coverity points out it's possible for one of the virCommand{Output|Error}*
API's to have not allocated 'output' and/or 'error' in which case the
strstr comparison will cause a NULL deref
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 6005bac4
...@@ -413,8 +413,8 @@ virStorageBackendDiskFindLabel(const char* device) ...@@ -413,8 +413,8 @@ virStorageBackendDiskFindLabel(const char* device)
/* if parted succeeds we have a valid partition table */ /* if parted succeeds we have a valid partition table */
ret = virCommandRun(cmd, NULL); ret = virCommandRun(cmd, NULL);
if (ret < 0) { if (ret < 0) {
if (strstr(output, "unrecognised disk label") || if ((output && strstr(output, "unrecognised disk label")) ||
strstr(error, "unrecognised disk label")) { (error && strstr(error, "unrecognised disk label"))) {
ret = 1; ret = 1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册