map

minimalistic audio player
git clone https://porkepik.fr/map
Log | Files | Refs | README | LICENSE

commit 495cf60f649dcf7c98f063038f753bbf8b41c377
parent 7b1aedde6dfe8007a78106c4efab9e3f07f360cc
Author: Thomas Philippe <dev@porkepik.fr>
Date:   Tue, 27 Aug 2019 02:35:56 +0200

fix string not guaranteed to be null terminated

Diffstat:
Mmap.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/map.c b/map.c @@ -109,8 +109,9 @@ display_tracks(char **lines, int nb_lines, int start_index) line_len = strlen(lines[i]); if (line_len > (unsigned long) cols) line_len = cols; - buf = realloc(buf, buf_len + line_len); + buf = realloc(buf, buf_len + line_len + 1); strncpy(&buf[buf_len], lines[i], line_len); + buf[buf_len+line_len] = '\0'; buf_len += line_len; }