tools/xenstored: Correctly read the requests header from the stream
authorJulien Grall <jgrall@amazon.com>
Fri, 25 Jun 2021 06:45:22 +0000 (07:45 +0100)
committerJulien Grall <jgrall@amazon.com>
Fri, 25 Jun 2021 09:40:06 +0000 (10:40 +0100)
commit8a9b94982b0e0928ad874907f5a5b005944ab7cf
tree514fdd7f710449daca223db64d40d21a2ddedf45
parente87d8f60fa9b6eaa6a2357545a96e4fff05dbef0
tools/xenstored: Correctly read the requests header from the stream

Commit c0fe360f42 ("tools/xenstored: Extend restore code to handle
multiple input buffer") extend the read_buffered_state() to support
multiple input buffers. Unfortunately, the commit didn't go far
enough and still used sc->data (start of the buffers) for retrieving
the header. This would lead to read the wrong headers for second and
follow-up commands.

Use data in place for sc->data for the source of the memcpy()s.

Fixes: c0fe360f42 ("tools/xenstored: Extend restore code to handle multiple input buffer")
Reported-by: Raphael Ning <raphning@amazon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
tools/xenstore/xenstored_core.c