We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3338

Summary: console_wmain doesn't null terminate the argv array
Product: SDL Reporter: Simon Hug <chli.hug>
Component: mainAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: HG 2.0   
Hardware: All   
OS: Windows (All)   
Attachments: Patch that null terminates the argv array in console_wmain.

Description Simon Hug 2016-05-20 08:44:41 UTC
Created attachment 2458 [details]
Patch that null terminates the argv array in console_wmain.

The function console_wmain in src/main/windows/SDL_windows_main.c does not null terminate the argument list it is creating. As specified by the C standard, "argv[argc] shall be a null pointer."

The SDLTest framework makes use of that null pointer and some test programs can cause an access violation because it's missing.

The attached patch adds the missing NULL.
Comment 1 Sam Lantinga 2016-10-01 18:48:38 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/db023d8a1c8b