Skip to content

Commit 8eba67c

Browse files
committed
Address code review
1 parent e0390b6 commit 8eba67c

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/ocsp/clu_ocsp.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* clu_ocsp.c
22
*
3-
* Copyright (C) 2006-2025 wolfSSL Inc.
3+
* Copyright (C) 2006-2026 wolfSSL Inc.
44
*
55
* This file is part of wolfSSL.
66
*
@@ -511,10 +511,11 @@ static byte respBuffer[16384];
511511
#ifndef _WIN32
512512
#include <signal.h>
513513
#include <errno.h>
514+
static volatile sig_atomic_t shutdownRequested = 0;
515+
#else
516+
static volatile int shutdownRequested = 0;
514517
#endif
515518

516-
static volatile sig_atomic_t shutdownRequested = 0;
517-
518519
#ifndef _WIN32
519520
/* Signal handler for SIGINT and SIGTERM - sets shutdown flag */
520521
static void ocspSignalHandler(int sig)
@@ -868,6 +869,9 @@ static int ocspResponder(OcspResponderConfig* config)
868869
if (transportSendResponse(clientfd, transportType, respBuffer, (int)respSz) != 0)
869870
goto continue_loop;
870871

872+
/* Only count successfully processed requests toward the -nrequest
873+
* limit. Failed reads/sends jump to continue_loop above, so a
874+
* misbehaving client cannot exhaust the budget. */
871875
requestsProcessed++;
872876

873877
/* Check if we've hit the request limit */

src/tools/clu_http.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ int wolfCLU_HttpServerSendError(SOCKET_T clientfd, int statusCode,
379379
return -1;
380380
}
381381

382-
return (send(clientfd, response, (size_t)len, 0) == len) ? 0 : -1;
382+
return (wolfCLU_SendAll(clientfd, response, len) == len) ? 0 : -1;
383383
}
384384

385385
/**
@@ -434,7 +434,7 @@ int wolfCLU_HttpServerParseRequest(const byte* httpReq, int httpReqSz,
434434
}
435435

436436
/* Find body (has to appear after headers) */
437-
bodyStart = XSTRSTR((char*)contentLen, "\r\n\r\n");
437+
bodyStart = XSTRSTR(contentLen != NULL ? contentLen : (char*)httpReq, "\r\n\r\n");
438438
if (!bodyStart)
439439
return -1;
440440
bodyAvail = (int)(((char*)httpReq + httpReqSz) -

wolfclu/clu_header_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ int wolfCLU_HttpServerParseRequest(const byte* httpReq, int httpReqSz,
738738
* @param sockfd socket descriptor
739739
* @param buffer buffer to store the complete request
740740
* @param bufferSz size of buffer
741-
* @param req output structure to store parsed request (defined in clu_scgi.h)
741+
* @param req output structure to store parsed request
742742
* @return 0 on success, negative on error
743743
*/
744744
struct ScgiRequest {

0 commit comments

Comments
 (0)