tools/xenstored: Avoid unnecessary talloc_strdup() in do_lu_start()
authorJulien Grall <jgrall@amazon.com>
Thu, 25 Feb 2021 15:43:04 +0000 (15:43 +0000)
committerJulien Grall <jgrall@amazon.com>
Fri, 26 Feb 2021 09:45:58 +0000 (09:45 +0000)
commit702b44be43b431695dd9ab49ca4a89ea50e31711
tree31a1a22834a0855e0b60e32a41395b20676d2ce1
parent2fc7939e26d223b2a8ce37204ea479d013444b7f
tools/xenstored: Avoid unnecessary talloc_strdup() in do_lu_start()

At the moment, the return of talloc_strdup() is not checked. This means
we may dereference a NULL pointer if the allocation failed.

However, it is pointless to allocate the memory as send_reply() will
copy the data to a different buffer. So drop the use of talloc_strdup().

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Fixes: af216a99fb4a ("tools/xenstore: add the basic framework for doing the live update")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/xenstore/xenstored_control.c