diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-10-18 13:09:46 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-10-22 04:51:13 -0400 |
commit | dbedca39fe30db87b6401e4396f959c63d90082e (patch) | |
tree | 9fc6303fd7ac83d62360896534b4964bc4245c5e | |
parent | 5b15c95f889c7bc43cb759c27211c597c0ad9f05 (diff) |
[ALSA] Fix re-use of va_list
The va_list is designed to be used only once. The current code
may pass va_list arguments multiple times and may cause Oops.
Copy/release the arguments temporarily to avoid this problem.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/core/info.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/core/info.c b/sound/core/info.c index e43662b33f16..0b4aab3225e5 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -120,7 +120,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...) | |||
120 | len = buffer->len - buffer->size; | 120 | len = buffer->len - buffer->size; |
121 | va_start(args, fmt); | 121 | va_start(args, fmt); |
122 | for (;;) { | 122 | for (;;) { |
123 | res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args); | 123 | va_list ap; |
124 | va_copy(ap, args); | ||
125 | res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap); | ||
126 | va_end(ap); | ||
124 | if (res < len) | 127 | if (res < len) |
125 | break; | 128 | break; |
126 | err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE); | 129 | err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE); |