Commit Diff
--- http.c +++ http.c @@ -270,7 +270,8 @@ http_recv(struct http_hdl *hdl) char buf[1024] = { 0 }; int ret; - ret = recv(hdl->sockfd, buf, 1024, 0); + ret = recv(hdl->sockfd, buf, 1024 - 1, 0); + buf[ret + 1] = '\0'; printf("%s", buf); return ret; }
