fix: null-terminate versionSubstring in OGLGetDriverVersion

This commit is contained in:
En-En 2024-11-02 18:09:49 +00:00
parent 6690a8cedd
commit 6f1d4e1d5c
1 changed files with 2 additions and 1 deletions

View File

@ -733,7 +733,8 @@ static void OGLGetDriverVersion(const char *oglVersionString,
} }
// Copy the version substring and parse it. // 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); strncpy(versionSubstring, versionStrStart, versionStringLength);
unsigned int major = 0; unsigned int major = 0;