aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/objectlabel.c
diff options
context:
space:
mode:
authorMark Janes <[email protected]>2016-05-03 13:50:49 -0700
committerMark Janes <[email protected]>2016-05-03 14:07:31 -0700
commit0af8a7d50ce0fdb8063f7fadd3b78975a2136d87 (patch)
tree59ce0e5924d320158232526c6afb33b151168d4c /src/mesa/main/objectlabel.c
parent265fe9dce8727d8777153fa9846300051141a88e (diff)
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 <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/objectlabel.c')
-rw-r--r--src/mesa/main/objectlabel.c7
1 files changed, 4 insertions, 3 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,13 +104,14 @@ copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize)
* will be returned in <length>."
*/
+ if (src)
+ labelLen = strlen(src);
+
if (bufSize == 0) {
if (length)
- *length = strlen(src);
+ *length = labelLen;
return;
}
- if (src)
- labelLen = strlen(src);
if (dst) {
if (src) {