mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-08 23:34:15 +00:00
Codechange: Limit field width to avoid sscanf crash
This commit is contained in:
parent
a4a6e5dfb4
commit
d1b7eb2de1
@ -917,7 +917,8 @@ void NetworkGameLoop()
|
||||
if (*p == ' ') p++;
|
||||
cp = CallocT<CommandPacket>(1);
|
||||
int company;
|
||||
int ret = sscanf(p, "%x; %x; %x; %x; %x; %x; %x; \"%[^\"]\"", &next_date, &next_date_fract, &company, &cp->tile, &cp->p1, &cp->p2, &cp->cmd, cp->text);
|
||||
assert_compile(sizeof(cp->text) == 128);
|
||||
int ret = sscanf(p, "%x; %x; %x; %x; %x; %x; %x; \"%127[^\"]\"", &next_date, &next_date_fract, &company, &cp->tile, &cp->p1, &cp->p2, &cp->cmd, cp->text);
|
||||
/* There are 8 pieces of data to read, however the last is a
|
||||
* string that might or might not exist. Ignore it if that
|
||||
* string misses because in 99% of the time it's not used. */
|
||||
|
Loading…
Reference in New Issue
Block a user