diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-03-11 10:34:10 +0300 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2020-03-19 22:09:04 +0300 |
commit | b83caf42532b25d59cf78c135c6433581b3cd77c (patch) | |
tree | 36546a4b1ac18de5bbb038b1cb2a01fea87a494b /drivers/gpu/drm/msm | |
parent | 4c145df18f71782007276b670d060d39393fd393 (diff) | |
download | linux-b83caf42532b25d59cf78c135c6433581b3cd77c.tar.xz |
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>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r-- | drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 7fd29829b2fa..1d5c43c22269 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -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; |