25 lines
784 B
Diff
25 lines
784 B
Diff
|
From: Bruce Rogers <brogers@suse.com>
|
||
|
Date: Tue, 28 May 2019 13:35:39 -0600
|
||
|
Subject: target/ppc: ensure we get null terminated rtas token name
|
||
|
|
||
|
Leave room for null termination of the string when doing strncpy.
|
||
|
|
||
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
||
|
---
|
||
|
target/ppc/kvm.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
|
||
|
index 2427c8ee13..7885de2d7c 100644
|
||
|
--- a/target/ppc/kvm.c
|
||
|
+++ b/target/ppc/kvm.c
|
||
|
@@ -2605,7 +2605,7 @@ int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function)
|
||
|
return -ENOENT;
|
||
|
}
|
||
|
|
||
|
- strncpy(args.name, function, sizeof(args.name));
|
||
|
+ strncpy(args.name, function, sizeof(args.name) - 1);
|
||
|
|
||
|
return kvm_vm_ioctl(kvm_state, KVM_PPC_RTAS_DEFINE_TOKEN, &args);
|
||
|
}
|