Skip to content

Commit

Permalink
fix(SIGSEGV): fixed sigsegv in http_read_cb_override
Browse files Browse the repository at this point in the history
  • Loading branch information
martinopresnik authored and irmana committed May 30, 2018
1 parent c2860e1 commit 911035e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/http_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ void http_read_cb_override(uv_link_t *link, ssize_t nread, const uv_buf_t *buf)
// TODO: Remove this line
//log_debug("%s text: %.*s", __FUNCTION__, nread, buf->base);

int status_line_len = strchr(buf->base, '\r') - buf->base;
int status_line_len;
for (status_line_len = 0; status_line_len < nread && buf->base[status_line_len] != '\r'; ++status_line_len)
;
context->request.status_line = malloc(status_line_len + 1);
memcpy(context->request.status_line, buf->base, status_line_len);
context->request.status_line[status_line_len] = '\0';
Expand Down

0 comments on commit 911035e

Please sign in to comment.