UDP_Socket: Add missing limit checks for s, for client and broadcast addresses

This commit is contained in:
Monster Iestyn 2018-09-03 15:43:36 +01:00
parent 6ae78da47e
commit 24aafa6dac

View file

@ -1044,7 +1044,7 @@ static boolean UDP_Socket(void)
if (gaie == 0)
{
runp = ai;
while (runp != NULL)
while (runp != NULL && s < MAXNETNODES+1)
{
memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen);
s++;
@ -1064,7 +1064,7 @@ static boolean UDP_Socket(void)
if (gaie == 0)
{
runp = ai;
while (runp != NULL)
while (runp != NULL && s < MAXNETNODES+1)
{
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
s++;
@ -1087,7 +1087,7 @@ static boolean UDP_Socket(void)
if (gaie == 0)
{
runp = ai;
while (runp != NULL)
while (runp != NULL && s < MAXNETNODES+1)
{
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
s++;