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 2315

Summary: Array w going out of boundary in read_config_file function
Product: SDL_mixer Reporter: Nitz <nitin.j4>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: sezeroz
Version: 1.2.12   
Hardware: x86   
OS: Linux   

Description Nitz 2013-12-18 09:09:58 UTC
In static int read_config_file(const char *name) function array going out of boundary at :

while (w[words] && (words < MAXWORDS))
      {
        w[++words]=strtok(0," \t\r\n\240");
        if (w[words] && w[words][0]=='#') break;
      }
here w[++words] will go out of boundary when words = MAXWORDS
So to avoid this, fix should be:

while (w[words] && (++words < MAXWORDS))
      {
        w[words]=strtok(0," \t\r\n\240");
        if (w[words] && w[words][0]=='#') break;
      }

Thanks...
Comment 1 Ozkan Sezer 2015-05-03 09:08:11 UTC
This is a dup of #2872 (and #2966)
Comment 2 Sam Lantinga 2015-05-05 05:13:56 UTC
This is a duplicate of 2966

*** This bug has been marked as a duplicate of bug 2966 ***