mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
fix potential overflow on env vars settings.
changing a bit Q_strlcpy flow as it can report wrong bytes copied if src > buffer size.
This commit is contained in:
parent
e0dd7c9d00
commit
07553f0980
1 changed files with 4 additions and 4 deletions
|
@ -270,13 +270,13 @@ CL_Setenv_f(void)
|
|||
char buffer[1000];
|
||||
int i;
|
||||
|
||||
strcpy(buffer, Cmd_Argv(1));
|
||||
strcat(buffer, "=");
|
||||
Q_strlcpy(buffer, Cmd_Argv(1), sizeof(buffer));
|
||||
Q_strlcat(buffer, "=", sizeof(buffer));
|
||||
|
||||
for (i = 2; i < argc; i++)
|
||||
{
|
||||
strcat(buffer, Cmd_Argv(i));
|
||||
strcat(buffer, " ");
|
||||
Q_strlcat(buffer, Cmd_Argv(i), sizeof(buffer));
|
||||
Q_strlcat(buffer, " ", sizeof(buffer));
|
||||
}
|
||||
|
||||
putenv(buffer);
|
||||
|
|
Loading…
Reference in a new issue