On 12/11/19 6:23 AM, Paolo Bonzini wrote:
> @@ -44,8 +44,7 @@ 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));
> +    memcpy(global_state.runstate, state, strlen(state) + 1);

We should assign the strlen result to a local variable rather than compute it
twice.


r~


Reply via email to