Skip to content

Commit

Permalink
fix: null-terminate versionSubstring in OGLGetDriverVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
En-En-Code committed Nov 2, 2024
1 parent 6690a8c commit 6f1d4e1
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 6f1d4e1

Please sign in to comment.