]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
alsa writer: Do not print uninitialized data.
authorAndre Noll <maan@systemlinux.org>
Wed, 15 May 2013 20:33:24 +0000 (22:33 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 19 May 2013 13:19:58 +0000 (15:19 +0200)
ALSA's snd_output_buffer_string() returns the current size of valid
data in the returned data buffer, but this buffer is not guaranteed
to be zero-terminated.

Currently alsa_init() ignores this fact and prints the buffer up to
the first NULL byte.  Therefore it may print garbage that follows the
valid data in the buffer. If there is no zero byte after the data,
it may even segfault.

Fix this bug by using memchr() instead of strchr() and carefully
tracking the number of bytes processed.


No differences found