Bug 63965 - Uninitialized variable in winnt_accept()
Summary: Uninitialized variable in winnt_accept()
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Platform (show other bugs)
Version: 2.5-HEAD
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Reported: 2019-11-27 07:53 UTC by Marc Stern
Modified: 2020-03-08 10:30 UTC (History)
0 users

Quick patch as suggested by Marc (502 bytes, patch)
2019-12-28 15:26 UTC, Giovanni Bechis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Stern 2019-11-27 07:53:01 UTC
In winnt_accept() (server/mpm/winnt/child.c), there's a call to PostQueuedCompletionStatus() with a buffer (BytesRead) for the number of bytes read.

When compiling the code with Visual Studio 2019 (v 16.3.10), we get a warning than BytesRead is not initialized. When using /RTCu (run-time checks for uninitialzed variables), the program crashes on this line with an exception.

If we initialize the variable to 0, the problem is solved.
Comment 1 Marc Stern 2019-12-11 09:39:28 UTC
Fixed in 2.4.41 (maybe before)
Comment 2 Marc Stern 2019-12-11 09:42:55 UTC
Sorry, it's not fixed. My mistake
Comment 3 Giovanni Bechis 2019-12-28 15:26:05 UTC
Created attachment 36935 [details]
Quick patch as suggested by Marc
Comment 4 Christophe JAILLET 2020-01-06 21:32:45 UTC
Fixed in trunk in r1872394.
Comment 5 Christophe JAILLET 2020-03-08 10:30:53 UTC
Backported in 2.4.x branch in r1874971.

Will be part of 2.4.42.