From 0af8a7d50ce0fdb8063f7fadd3b78975a2136d87 Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Tue, 3 May 2016 13:50:49 -0700 Subject: [PATCH] mesa/objectlabel: handle NULL src string This prevents a crash when a NULL src is passed with a non-NULL length. fixes: dEQP-GLES31.functional.debug.object_labels.query_length_only Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95252 Signed-off-by: Mark Janes Reviewed-by: Dave Airlie --- src/mesa/main/objectlabel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index b77cb5c4e36..5070b008792 100644 --- a/src/mesa/main/objectlabel.c +++ b/src/mesa/main/objectlabel.c @@ -104,14 +104,15 @@ copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize) * will be returned in ." */ - if (bufSize == 0) { - if (length) - *length = strlen(src); - return; - } if (src) labelLen = strlen(src); + if (bufSize == 0) { + if (length) + *length = labelLen; + return; + } + if (dst) { if (src) { if (bufSize <= labelLen)