Skip to content

Commit

Permalink
Merge pull request #860 from En-En-Code/oglgetdriverversion-fix
Browse files Browse the repository at this point in the history
fix: null-terminate versionSubstring in OGLGetDriverVersion
  • Loading branch information
zeromus authored Nov 3, 2024
2 parents 6690a8c + 6f1d4e1 commit f51e19b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion desmume/src/OGLRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ static void OGLGetDriverVersion(const char *oglVersionString,
}

// Copy the version substring and parse it.
char *versionSubstring = (char *)malloc(versionStringLength * sizeof(char));
char *versionSubstring = (char *)malloc((versionStringLength + 1) * sizeof(char));
versionSubstring[versionStringLength] = '\0';
strncpy(versionSubstring, versionStrStart, versionStringLength);

unsigned int major = 0;
Expand Down

0 comments on commit f51e19b

Please sign in to comment.