Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

in TCPInterface::Connect, there may access array overflow #69

Open
heroboy opened this issue Jul 31, 2015 · 0 comments
Open

in TCPInterface::Connect, there may access array overflow #69

heroboy opened this issue Jul 31, 2015 · 0 comments

Comments

@heroboy
Copy link

heroboy commented Jul 31, 2015

    int newRemoteClientIndex=-1;
    for (newRemoteClientIndex=0; newRemoteClientIndex < remoteClientsLength; newRemoteClientIndex++)
    {
        remoteClients[newRemoteClientIndex].isActiveMutex.Lock();
        if (remoteClients[newRemoteClientIndex].isActive==false)
        {
            remoteClients[newRemoteClientIndex].SetActive(true);
            remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
            break;
        }
        remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
    }
    if (newRemoteClientIndex==-1)
        return UNASSIGNED_SYSTEM_ADDRESS;

if all removeClients is inactive then newRemoteClientIndex==remoteClientsLength. But the code doesn't check for that. And use newRemoteClientIndex as usual.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant