Pass 'sizeof(mybuf) - 1' as the size of 'mybuf' in get_cmd_line().
This fixes an out-of-bounds access when recv() writes exactly 256 bytes into 'mybuf' and the subsequent code accesses or writes to the byte following the end of the 'mybuf' array.
This commit is contained in:
parent
b01c4f661d
commit
3b74b2d1d6
1 changed files with 1 additions and 1 deletions
|
@ -424,7 +424,7 @@ namespace pvpgn
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (admin_to_stop()) return -1;
|
if (admin_to_stop()) return -1;
|
||||||
if ((bytes=recv(ns, mybuf, sizeof(mybuf), 0))<=0)
|
if ((bytes=recv(ns, mybuf, sizeof(mybuf) - 1, 0))<=0)
|
||||||
return -1;
|
return -1;
|
||||||
timeoutcount = 0;
|
timeoutcount = 0;
|
||||||
*(mybuf+bytes) = '\0';
|
*(mybuf+bytes) = '\0';
|
||||||
|
|
Loading…
Reference in a new issue