summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/objectlabel.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-05-03 17:32:28 +1000
committerDave Airlie <airlied@redhat.com>2016-05-03 20:12:59 +1000
commit5989a2937f6a77e8f32ccc30cc7f9b3bd7bed9eb (patch)
treef20df7cd5d1b2fff479d4259efc55feee1c8346f /src/mesa/main/objectlabel.c
parent30823f997b96e3568bc94827253e3a2b08e86598 (diff)
downloadexternal_mesa3d-5989a2937f6a77e8f32ccc30cc7f9b3bd7bed9eb.zip
external_mesa3d-5989a2937f6a77e8f32ccc30cc7f9b3bd7bed9eb.tar.gz
external_mesa3d-5989a2937f6a77e8f32ccc30cc7f9b3bd7bed9eb.tar.bz2
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>
Diffstat (limited to 'src/mesa/main/objectlabel.c')
-rw-r--r--src/mesa/main/objectlabel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index b622d6a..b77cb5c 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -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);