Replace strcpy with std::move in multi_message_input_sub

The documentation for `strcpy` states in part:

```
The strings may not overlap
```

However, for this use, the strings do overlap.  Switch to `std::move`,
which is documented to handle this so long as the destination iterator
is outside the source range, which it will be for this use.
This commit is contained in:
Kp 2022-11-08 02:55:09 +00:00
parent 1e093bacae
commit cb53ce8c0e

View file

@ -1552,10 +1552,7 @@ window_event_result multi_message_input_sub(const d_robot_info_array &Robot_info
sending = msgsend_state::typing;
multi_send_msgsend_state(msgsend_state::typing);
auto pcolon = strstr(Network_message.data(), ": " );
if ( pcolon )
strcpy( pcolon+2, ptext );
else
strcpy(Network_message.data(), ptext);
std::move(ptext, std::cend(Network_message), pcolon ? std::next(pcolon, 2) : Network_message.data());
multi_message_index = strlen( Network_message );
}
}