tools/xenstored: Avoid unnecessary talloc_strdup() in do_control_lu()
authorJulien Grall <jgrall@amazon.com>
Thu, 25 Feb 2021 15:15:23 +0000 (15:15 +0000)
committerJulien Grall <jgrall@amazon.com>
Fri, 26 Feb 2021 09:45:41 +0000 (09:45 +0000)
commit2fc7939e26d223b2a8ce37204ea479d013444b7f
tree71674dea0b53d89d7a1f986e5505fde6ad5b73c5
parent68b92ee7fef27f85846ef892e3d2e1763807b72d
tools/xenstored: Avoid unnecessary talloc_strdup() in do_control_lu()

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: fecab256d474 ("tools/xenstore: add basic live-update command parsing")
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