drm/msm: Use scnprintf() for avoiding potential buffer overflow
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
parent
4c145df18f
commit
b83caf4253
|
@ -673,7 +673,7 @@ static char *adreno_gpu_ascii85_encode(u32 *src, size_t len)
|
|||
return NULL;
|
||||
|
||||
for (i = 0; i < l; i++)
|
||||
buf_itr += snprintf(buf + buf_itr, buffer_size - buf_itr, "%s",
|
||||
buf_itr += scnprintf(buf + buf_itr, buffer_size - buf_itr, "%s",
|
||||
ascii85_encode(src[i], out));
|
||||
|
||||
return buf;
|
||||
|
|
Loading…
Reference in New Issue