If 64 (sizeof(buf))= or more characters were provided in the input string,
this unconditionally writes a null byte to `buf[64]`, which is one byte
past the end of the array.
Closes: https://github.com/alsa-project/alsa-lib/pull/509
Signed-off-by: Dirk Müller <dirk@dmllr.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ptr = buf;
size = 0;
while (*str && *str != ',') {
- if (size < (int)sizeof(buf)) {
+ if (size < (int)sizeof(buf) - 1) {
*ptr++ = *str;
size++;
}