shithub: tinygl

Download patch

ref: e99c9f329ea7b242e903839d0c1dc8399bba9f7b
parent: 9651298a00411bcf60b1191676ce647756f149f4
parent: 2c7759454b08e343c23d64b361f79550166dab9d
author: DMHSW <6974902+gek169@users.noreply.github.com>
date: Sat Nov 12 13:30:30 EST 2022

Merge pull request #20 from zodf0055980/main

Fix global buffer overflow at glMaterialfv

--- a/src/api.c
+++ b/src/api.c
@@ -378,7 +378,7 @@
 	n = 4;  /* This appears to be a hack... to avoid a jump instruction? What the hell?*/
 	if (type == GL_SHININESS)
 		n = 1;
-	for (i = 0; i < 4; i++)
+	for (i = 0; i < n; i++)
 		p[3 + i].f = v[i];
 	for (i = n; i < 4; i++)
 		p[3 + i].f = 0;