netfile: fix stack buffer overflow

Origin commit data
------------------
Branch: ni/coolstream
Commit: 0353d1b1ee
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-03-03 (Sun, 03 Mar 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2019-03-03 22:20:23 +01:00
committed by vanhofen
parent 8d5e9c2e25
commit ad6aeef96a

View File

@@ -577,13 +577,13 @@ void readln(int fd, char *buf)
int parse_response(URL *url, void * /*opt*/, CSTATE *state) 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; char *ptr, chr=0, lastchr=0;
int hlen = 0, response; int hlen = 0, response;
int meta_interval = 0, rval; int meta_interval = 0, rval;
int fd = url->fd; int fd = url->fd;
memset(header, 0, 2048); memset(header, 0, 2049);
ptr = header; ptr = header;
/* extract the http header from the stream */ /* extract the http header from the stream */
@@ -1745,7 +1745,7 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state)
else else
{ {
//SKIP() //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); strncpy(state->title, ptr,bufsize);
ptr = strchr(state->title, ';'); ptr = strchr(state->title, ';');