projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f09d4f2
)
ALSA: hdsp: silence a sprinft() overflow warning
author
Dan Carpenter
<dan.carpenter@oracle.com>
Sat, 22 Aug 2015 09:24:13 +0000
(12:24 +0300)
committer
Takashi Iwai
<tiwai@suse.de>
Sat, 22 Aug 2015 09:36:26 +0000
(11:36 +0200)
card->shortname is a 32 char string so the sprintf() can theoretically
overflow. snd_rawmidi_new() can accept strings up to 64 bytes long.
I have made the temporay buf[] array 40 bytes long and changed the
sprintf() to snprintf().
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/rme9652/hdsp.c
patch
|
blob
|
blame
|
history
diff --git
a/sound/pci/rme9652/hdsp.c
b/sound/pci/rme9652/hdsp.c
index 468a95cdce70e74b5e5ce15369cc343bbdda419b..9bba275b4c9b08ba3dd4ff763afd6b17669af48d 100644
(file)
--- a/
sound/pci/rme9652/hdsp.c
+++ b/
sound/pci/rme9652/hdsp.c
@@
-1526,7
+1526,7
@@
static struct snd_rawmidi_ops snd_hdsp_midi_input =
static int snd_hdsp_create_midi (struct snd_card *card, struct hdsp *hdsp, int id)
{
- char buf[
32
];
+ char buf[
40
];
hdsp->midi[id].id = id;
hdsp->midi[id].rmidi = NULL;
@@
-1537,7
+1537,7
@@
static int snd_hdsp_create_midi (struct snd_card *card, struct hdsp *hdsp, int i
hdsp->midi[id].pending = 0;
spin_lock_init (&hdsp->midi[id].lock);
- s
printf (buf, "%s MIDI %d", card->shortname, id+
1);
+ s
nprintf(buf, sizeof(buf), "%s MIDI %d", card->shortname, id +
1);
if (snd_rawmidi_new (card, buf, id, 1, 1, &hdsp->midi[id].rmidi) < 0)
return -1;