Commit Diff


commit - e982cc2e4b55b65b6c7a12871b1e0f9ec6d0a44f
commit + a7af6791a33806f453e1aae5b6c0c165eb7962da
blob - 3cc4028ef2585b53b25b0d078f45143242a6ac95
blob + 612d4856ced78a9e50412fb7a6ae4d3ae9935b36
--- 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;
 }