Bladeren bron

Fix #686 CivetServer::getPostData valgrind UninitCondition

Ivan Dlugos 6 jaren geleden
bovenliggende
commit
2a3f39eb90
1 gewijzigde bestanden met toevoegingen van 1 en 3 verwijderingen
  1. 1 3
      src/CivetServer.cpp

+ 1 - 3
src/CivetServer.cpp

@@ -582,9 +582,7 @@ CivetServer::getPostData(struct mg_connection *conn)
 	char buf[2048];
 	int r = mg_read(conn, buf, sizeof(buf));
 	while (r > 0) {
-		std::string p = std::string(buf);
-		p.resize(r);
-		postdata += p;
+		postdata += std::string(buf, r);
 		r = mg_read(conn, buf, sizeof(buf));
 	}
 	mg_unlock_connection(conn);