[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 8/8] migration: use pstrcpy to copy run state
From: |
Alex Bennée |
Subject: |
[PATCH v1 8/8] migration: use pstrcpy to copy run state |
Date: |
Thu, 3 Sep 2020 12:21:07 +0100 |
The gcov build triggered:
../../migration/global_state.c:47:5: error: ‘strncpy’ specified
bound 100 equals destination size [-Werror=stringop-truncation]
strncpy((char *)global_state.runstate
As we shouldn't be using strncpy anyway lets use the suggested
pstrcpy.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
migration/global_state.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/migration/global_state.c b/migration/global_state.c
index 25311479a4b..5fbe6d1ff07 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -44,8 +44,8 @@ void global_state_store_running(void)
{
const char *state = RunState_str(RUN_STATE_RUNNING);
assert(strlen(state) < sizeof(global_state.runstate));
- strncpy((char *)global_state.runstate,
- state, sizeof(global_state.runstate));
+ pstrcpy((char *)global_state.runstate, sizeof(global_state.runstate),
+ state);
}
bool global_state_received(void)
--
2.20.1
- [PATCH v1 0/8] some testing and CI updates (re-greening), Alex Bennée, 2020/09/03
- [PATCH v1 1/8] CODING_STYLE.rst: flesh out our naming conventions., Alex Bennée, 2020/09/03
- [PATCH v1 2/8] crypto: fix build with gcrypt enabled, Alex Bennée, 2020/09/03
- [PATCH v1 3/8] tests/docker: add python3-setuptools the docker images, Alex Bennée, 2020/09/03
- [PATCH v1 4/8] usb-host: restrict workaround to new libusb versions, Alex Bennée, 2020/09/03
- [PATCH v1 5/8] qemu-iotests: move check-block back to Makefiles, Alex Bennée, 2020/09/03
- [PATCH v1 8/8] migration: use pstrcpy to copy run state,
Alex Bennée <=
- [PATCH v1 6/8] tests/meson.build: fp tests don't need CONFIG_TCG, Alex Bennée, 2020/09/03
[PATCH v1 7/8] target/mips: simplify gen_compute_imm_branch logic, Alex Bennée, 2020/09/03