bel2125 2 سال پیش
والد
کامیت
11b8f8752a
2فایلهای تغییر یافته به همراه11 افزوده شده و 12 حذف شده
  1. 9 11
      src/civetweb.c
  2. 2 1
      src/mod_mbedtls.inl

+ 9 - 11
src/civetweb.c

@@ -6672,21 +6672,21 @@ mg_read(struct mg_connection *conn, void *buf, size_t len)
 					if (mg_read_inner(conn, lenbuf + i, 1) != 1) {
 					if (mg_read_inner(conn, lenbuf + i, 1) != 1) {
 						lenbuf[i] = 0;
 						lenbuf[i] = 0;
 					}
 					}
-					if ((i > 0) && (lenbuf[i] == ';'))
-					{
+					if ((i > 0) && (lenbuf[i] == ';')) {
 						// chunk extension --> skip chars until next CR
 						// chunk extension --> skip chars until next CR
 						//
 						//
 						// RFC 2616, 3.6.1 Chunked Transfer Coding
 						// RFC 2616, 3.6.1 Chunked Transfer Coding
-					    // (https://www.rfc-editor.org/rfc/rfc2616#page-25)
+						// (https://www.rfc-editor.org/rfc/rfc2616#page-25)
 						//
 						//
 						// chunk          = chunk-size [ chunk-extension ] CRLF
 						// chunk          = chunk-size [ chunk-extension ] CRLF
 						//                  chunk-data CRLF
 						//                  chunk-data CRLF
 						// ...
 						// ...
-						// chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
+						// chunk-extension= *( ";" chunk-ext-name [ "="
+						// chunk-ext-val ] )
 						do
 						do
 							++conn->content_len;
 							++conn->content_len;
-						while (mg_read_inner(conn, lenbuf + i, 1) == 1 &&
-							   lenbuf[i] != '\r');
+						while (mg_read_inner(conn, lenbuf + i, 1) == 1
+						       && lenbuf[i] != '\r');
 					}
 					}
 					if ((i > 0) && (lenbuf[i] == '\r')
 					if ((i > 0) && (lenbuf[i] == '\r')
 					    && (lenbuf[i - 1] != '\r')) {
 					    && (lenbuf[i - 1] != '\r')) {
@@ -6732,7 +6732,7 @@ mg_read(struct mg_connection *conn, void *buf, size_t len)
 					// ...
 					// ...
 					// trailer        = *(entity-header CRLF)
 					// trailer        = *(entity-header CRLF)
 
 
-					int crlf_count = 2;  // one CRLF already determined
+					int crlf_count = 2; // one CRLF already determined
 
 
 					while (crlf_count < 4 && conn->is_chunked == 3) {
 					while (crlf_count < 4 && conn->is_chunked == 3) {
 						++conn->content_len;
 						++conn->content_len;
@@ -6742,8 +6742,7 @@ mg_read(struct mg_connection *conn, void *buf, size_t len)
 									++crlf_count;
 									++crlf_count;
 								else
 								else
 									crlf_count = 0;
 									crlf_count = 0;
-							}
-							else {
+							} else {
 								// previous character was a CR
 								// previous character was a CR
 								// --> next character must be LF
 								// --> next character must be LF
 
 
@@ -6752,8 +6751,7 @@ mg_read(struct mg_connection *conn, void *buf, size_t len)
 								else
 								else
 									conn->is_chunked = 2;
 									conn->is_chunked = 2;
 							}
 							}
-						}
-						else
+						} else
 							// premature end of trailer
 							// premature end of trailer
 							conn->is_chunked = 2;
 							conn->is_chunked = 2;
 					}
 					}

+ 2 - 1
src/mod_mbedtls.inl

@@ -104,7 +104,8 @@ mbed_sslctx_init(SSL_CTX *ctx, const char *crt)
 	// these functions. It is used for blinding, a countermeasure against
 	// these functions. It is used for blinding, a countermeasure against
 	// side-channel attacks.
 	// side-channel attacks.
 	// https://github.com/Mbed-TLS/mbedtls/blob/development/docs/3.0-migration-guide.md#some-functions-gained-an-rng-parameter
 	// https://github.com/Mbed-TLS/mbedtls/blob/development/docs/3.0-migration-guide.md#some-functions-gained-an-rng-parameter
-	rc = mbedtls_pk_parse_keyfile(&ctx->pkey, crt, NULL, mbedtls_ctr_drbg_random, &ctx->ctr);
+	rc = mbedtls_pk_parse_keyfile(
+	    &ctx->pkey, crt, NULL, mbedtls_ctr_drbg_random, &ctx->ctr);
 #else
 #else
 	rc = mbedtls_pk_parse_keyfile(&ctx->pkey, crt, NULL);
 	rc = mbedtls_pk_parse_keyfile(&ctx->pkey, crt, NULL);
 #endif
 #endif