Skip to content

Commit b83caf4

Browse files
tiwairobclark
authored andcommitted
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 <[email protected]> Reviewed-by: Jordan Crouse <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent 4c145df commit b83caf4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ static char *adreno_gpu_ascii85_encode(u32 *src, size_t len)
673673
return NULL;
674674

675675
for (i = 0; i < l; i++)
676-
buf_itr += snprintf(buf + buf_itr, buffer_size - buf_itr, "%s",
676+
buf_itr += scnprintf(buf + buf_itr, buffer_size - buf_itr, "%s",
677677
ascii85_encode(src[i], out));
678678

679679
return buf;

0 commit comments

Comments
 (0)