diff options
author | Dave Airlie <[email protected]> | 2016-05-03 17:32:28 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2016-05-03 20:12:59 +1000 |
commit | 5989a2937f6a77e8f32ccc30cc7f9b3bd7bed9eb (patch) | |
tree | f20df7cd5d1b2fff479d4259efc55feee1c8346f /src/mesa/main | |
parent | 30823f997b96e3568bc94827253e3a2b08e86598 (diff) |
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 <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/objectlabel.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index b622d6a2979..b77cb5c4e36 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); |