Skip to content
Permalink
Browse files

tools: gcov: Fix hypervisor image signature check

The header signature field is not zero-terminated. Use memcmp, just like
in the driver.

Fixes: 6462339 ("tools: new tool to get gcov data out of dirty firmware")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information...
jan-kiszka committed Jul 29, 2019
1 parent dee9b45 commit 55de0454d880b3094f46f2aecdd4b696a13c7fce
Showing with 2 additions and 1 deletion.
  1. +2 −1 tools/jailhouse-gcov-extract.c
@@ -186,7 +186,8 @@ int main(int argc, char **argv)
assert(count == hypervisor_size);

header = (struct jailhouse_header *)hypervisor;
if (strcmp(header->signature, JAILHOUSE_SIGNATURE)) {
if (memcmp(header->signature, JAILHOUSE_SIGNATURE,
sizeof(header->signature))) {
errno = EINVAL;
error(0, 0, "%s does not seem to be a hypervisor image",
filename);

0 comments on commit 55de045

Please sign in to comment.
You can’t perform that action at this time.