mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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:06d17943f0("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> master commit:db3382dd4fmaster date: 2022-06-23 13:44:10 +0100
This commit is contained in:
1 parent
b53df5b434
commit
7fe638c28f
1 file changed
+4
-1
@@ -1988,7 +1988,10 @@ void corrupt(struct connection *conn, const char *fmt, ...)
|
||||
va_end(arglist);
|
||||
|
||||
log("corruption detected by connection %i: err %s: %s",
|
||||
conn ? (int)conn->id : -1, strerror(saved_errno), str);
|
||||
conn ? (int)conn->id : -1, strerror(saved_errno),
|
||||
str ?: "ENOMEM");
|
||||
|
||||
talloc_free(str);
|
||||
|
||||
check_store();
|
||||
}
|
||||
|
||||