Skip to content

Commit

Permalink
nsiproxy: Only set the connection count from tcp_conns_enumerate_all …
Browse files Browse the repository at this point in the history
…when appropriate.

Fixes heap corruption downstream in NsiEnumerateObjectsAllParametersEx.
Fixes a regression from 9085bc7.
  • Loading branch information
misterfifths authored and julliard committed Sep 23, 2024
1 parent 8e41ea6 commit b81a189
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dlls/nsiproxy.sys/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,17 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k
*count = reply->count;
else if (ret == STATUS_BUFFER_TOO_SMALL)
{
*count = reply->count;
if (want_data)
if (!want_data)
{
free( connections );
return STATUS_BUFFER_OVERFLOW;
/* If we were given buffers, the outgoing count must never be
greater than the incoming one. If we weren't, the count
should be set to the actual count. */
*count = reply->count;
return STATUS_SUCCESS;
}
return STATUS_SUCCESS;

free( connections );
return STATUS_BUFFER_OVERFLOW;
}
}
SERVER_END_REQ;
Expand Down

0 comments on commit b81a189

Please sign in to comment.