pnoltes commented on code in PR #851:
URL: https://github.com/apache/celix/pull/851#discussion_r4307863016
##########
bundles/http_admin/http_admin/src/http_admin.c:
##########
@@ -173,6 +174,34 @@ void http_admin_removeHttpService(void *handle, void *svc
CELIX_UNUSED, const ce
}
}
+static bool httpAdmin_readRequestBody(struct mg_connection* connection, long
long contentLength, char** bufferOut, size_t* bytesReadOut) {
+ char* buffer = NULL;
+ size_t totalBytesRead = 0;
+ bool success = true;
+ if (contentLength > 0) {
+ size_t length = (contentLength > INT_MAX) ? INT_MAX :
(size_t)contentLength;
+ buffer = malloc(length + 1);
+ if (buffer == NULL) {
+ success = false;
+ } else {
+ while (totalBytesRead < length) {
+ int read = mg_read(connection, buffer + totalBytesRead, length
- totalBytesRead);
+ if (read <= 0) {
Review Comment:
Added EOF handling
##########
bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c:
##########
@@ -528,41 +528,54 @@ static int remoteServiceAdmin_callback(struct
mg_connection *conn) {
if (export != NULL) {
uint64_t datalength = request_info->content_length;
Review Comment:
I added a (configurable) upper bound
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]