mesa/objectlabel: don't do memcpy if bufSize is 0 (v2)

This prevents GL43-CTS.khr_debug.labels_non_debug from
memcpying all over the stack and crashing.

v2: actually fix the test.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie
2016-05-03 17:32:28 +10:00
parent 30823f997b
commit 5989a2937f
+5
View File
@@ -104,6 +104,11 @@ copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize)
* will be returned in <length>."
*/
if (bufSize == 0) {
if (length)
*length = strlen(src);
return;
}
if (src)
labelLen = strlen(src);