From: Tim Clem tclem@codeweavers.com
Fixes heap corruption downstream in NsiEnumerateObjectsAllParametersEx.
Fixes a regression from a3f737f6143. --- dlls/nsiproxy.sys/udp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c index 1d790484d8f..13d2e631b08 100644 --- a/dlls/nsiproxy.sys/udp.c +++ b/dlls/nsiproxy.sys/udp.c @@ -231,8 +231,14 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void *count = reply->count; else if (ret == STATUS_BUFFER_TOO_SMALL) { - *count = reply->count; - if (want_data) + if (!want_data) + { + /* 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; + } + else { free( endpoints ); return STATUS_BUFFER_OVERFLOW;