Browse Source

C++ wrapper: getCookie fix for empty cookies

Fixes #1102
bel2125 2 years ago
parent
commit
23af667eb9
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/CivetServer.cpp

+ 3 - 1
src/CivetServer.cpp

@@ -561,7 +561,9 @@ CivetServer::getCookie(struct mg_connection *conn,
 	                          _cookieValue,
 	                          _cookieValue,
 	                          sizeof(_cookieValue));
 	                          sizeof(_cookieValue));
 	cookieValue.clear();
 	cookieValue.clear();
-	cookieValue.append(_cookieValue);
+	if (lRead >= 0) {
+		cookieValue.append(_cookieValue);
+	}
 	return lRead;
 	return lRead;
 }
 }