]> git.tuebingen.mpg.de Git - paraslash.git/commit
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)
commit057a8c7cf2ca9f6aa8b97c5b3e4a09daca358134
treee468727b2fba4a15b3e6a86d923225a78923b09b
parent7532dc26edc72f4ec98acd0a62e1b02994c34171
alsa writer: Do not print uninitialized data.

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.
alsa_write.c