From e75c2a9d11234c537de1e66206f6a7dff0b5415f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 3 Mar 2019 22:20:23 +0100 Subject: [PATCH] netfile: fix stack buffer overflow Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/0353d1b1eeba36af7c61e152e94365e12f96ba7c Author: Jacek Jendrzej Date: 2019-03-03 (Sun, 03 Mar 2019) --- src/driver/netfile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index 70483a4d7..c40923980 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -577,13 +577,13 @@ void readln(int fd, char *buf) int parse_response(URL *url, void * /*opt*/, CSTATE *state) { - char header[2048], /*str[255]*/ str[2048]; // combined with 2nd local str from id3 part + char header[2049], /*str[255]*/ str[2049]; // combined with 2nd local str from id3 part char *ptr, chr=0, lastchr=0; int hlen = 0, response; int meta_interval = 0, rval; int fd = url->fd; - memset(header, 0, 2048); + memset(header, 0, 2049); ptr = header; /* extract the http header from the stream */ @@ -1745,7 +1745,7 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state) else { //SKIP() - for(int i = 0;(ptr && i < bufsize && !isalnum(*ptr)); ++ptr,i++){}; + for(int i = 0;(ptr && i < bufsize && *ptr && !isalnum(*ptr)); ++ptr,i++){}; strncpy(state->title, ptr,bufsize); ptr = strchr(state->title, ';');