提交 a001a5e2 编写于 作者: A Alex Jia 提交者: Michal Privoznik

util: avoid null deref on qcowXGetBackingStore

Detected by Coverity. the only case is caller passes a NULL to 'format' variable,
then taking 'if (format)' false branch, the function qcow2GetBackingStoreFormat
will directly dereferences the NULL 'format' pointer variable.
Signed-off-by: NAlex Jia <ajia@redhat.com>
上级 d082e1b9
...@@ -333,7 +333,7 @@ qcowXGetBackingStore(char **res, ...@@ -333,7 +333,7 @@ qcowXGetBackingStore(char **res,
* between the end of the header (QCOW2_HDR_TOTAL_SIZE) * between the end of the header (QCOW2_HDR_TOTAL_SIZE)
* and the start of the backingStoreName (offset) * and the start of the backingStoreName (offset)
*/ */
if (isQCow2) if (isQCow2 && format)
qcow2GetBackingStoreFormat(format, buf, buf_size, QCOW2_HDR_TOTAL_SIZE, offset); qcow2GetBackingStoreFormat(format, buf, buf_size, QCOW2_HDR_TOTAL_SIZE, offset);
return BACKING_STORE_OK; return BACKING_STORE_OK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册