Skip to content

Commit

Permalink
Update sys_net.c
Browse files Browse the repository at this point in the history
Added missing overflow check
  • Loading branch information
IceNinjaman authored Jan 8, 2017
1 parent 574e957 commit 3eb4a8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sys_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -4131,7 +4131,7 @@ int GetDNSAddresses(struct sockaddr_storage *sin, int maxcount)
}
pAdapterInfo = pAdapterInfo->Next; // Progress through linked list
}
while(pAdapterInfo); // Terminate if last adapter
while(pAdapterInfo && i < maxcount); // Terminate if last adapter
}
return i;
}
Expand All @@ -4151,7 +4151,7 @@ int GetDNSAddresses(struct sockaddr_storage *sin, int maxcount)

} else {
/* Try to figure out what DNS server to use */
for (; fgets(line, sizeof(line), fp) != NULL; )
for (; fgets(line, sizeof(line), fp) != NULL && i < maxcount; )
{
linep = line;
//Remove whitespace
Expand Down

0 comments on commit 3eb4a8d

Please sign in to comment.