When '@@' alone is sent on the master CLI (no trailing LF), we get an
error that displays anything past these two characters in the buffer
since there's no room for a \0. Let's make sure to limit the length of
the process name in this case. No backport is needed since this was added
with
00c967fac4 ("MINOR: master/cli: support bidirectional communications
with workers").
target_pid = pcli_prefix_to_pid(pid_str + 1);
if (target_pid == -1) {
- memprintf(errmsg, "Can't find the target PID matching the prefix '%s'\n", pid_str);
+ memprintf(errmsg, "Can't find the target PID matching the prefix '%.*s'\n", (int)(p - pid_str), pid_str);
ret = -1;
goto leave;
}