SCP: Avoid using strlcpy for overlapping string copy

This commit is contained in:
Mark Pizzolato 2022-01-16 07:44:15 -08:00
parent b0dcd191bb
commit 370bfe006d

6
scp.c
View file

@ -6504,8 +6504,10 @@ if (vdelt) {
if (1) { if (1) {
char mode[] = S_xstr(SIM_VERSION_MODE); char mode[] = S_xstr(SIM_VERSION_MODE);
if (NULL != strchr (mode, '\"')) /* Quoted String? */ if (NULL != strchr (mode, '\"')) { /* Quoted String? */
strlcpy (mode, mode + 1, strlen (mode) - 1);/* strip quotes */ mode[strlen (mode) - 1] = '\0'; /* strip quotes */
memmove (mode, mode + 1, strlen (mode));
}
fprintf (st, " %s", mode); fprintf (st, " %s", mode);
setenv ("SIM_VERSION_MODE", mode, 1); setenv ("SIM_VERSION_MODE", mode, 1);
} }