projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f276d3e
)
misc: mic: Use scnprintf() for avoiding potential buffer overflow
author
Takashi Iwai
<tiwai@suse.de>
Wed, 11 Mar 2020 07:49:16 +0000
(08:49 +0100)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 18 Mar 2020 11:24:19 +0000
(12:24 +0100)
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>
Link:
https://lore.kernel.org/r/20200311074916.8783-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/host/mic_x100.c
patch
|
blob
|
history
diff --git
a/drivers/misc/mic/host/mic_x100.c
b/drivers/misc/mic/host/mic_x100.c
index
a774331
..
d18cda9
100644
(file)
--- a/
drivers/misc/mic/host/mic_x100.c
+++ b/
drivers/misc/mic/host/mic_x100.c
@@
-350,10
+350,10
@@
mic_x100_load_command_line(struct mic_device *mdev, const struct firmware *fw)
if (!buf)
return -ENOMEM;
- len += snprintf(buf, CMDLINE_SIZE - len,
+ len += s
c
nprintf(buf, CMDLINE_SIZE - len,
" mem=%dM", boot_mem);
if (mdev->cosm_dev->cmdline)
- snprintf(buf + len, CMDLINE_SIZE - len, " %s",
+ s
c
nprintf(buf + len, CMDLINE_SIZE - len, " %s",
mdev->cosm_dev->cmdline);
memcpy_toio(cmd_line_va, buf, strlen(buf) + 1);
kfree(buf);