]> xenbits.xensource.com Git - xen.git/commit
tools/xenstored: Harden corrupt()
authorJulien Grall <jgrall@amazon.com>
Thu, 23 Jun 2022 12:43:23 +0000 (13:43 +0100)
committerJulien Grall <jgrall@amazon.com>
Thu, 23 Jun 2022 12:44:10 +0000 (13:44 +0100)
commitdb3382dd4f468c763512d6bf91c96773395058fb
treeb34ddbab929d1bfbff282daca8b94b76c43b7df7
parent61ac7919a6a38a24d26fd1b57a2511beb0724e99
tools/xenstored: Harden corrupt()

At the moment, corrupt() is neither checking for allocation failure
nor freeing the allocated memory.

Harden the code by printing ENOMEM if the allocation failed and
free 'str' after the last use.

This is not considered to be a security issue because corrupt() should
only be called when Xenstored thinks the database is corrupted. Note
that the trigger (i.e. a guest reliably provoking the call) would be
a security issue.

Fixes: 06d17943f0cd ("Added a basic integrity checker, and some basic ability to recover from store")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
tools/xenstore/xenstored_core.c