From 3e08bb4415e39c332fb3eb29e31748e0f9b0d55f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 2 Mar 2019 19:52:37 +0100 Subject: [PATCH] netfile: fix stack buffer overflow --- 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, ';');