V2/cppcheck 0702 clean#3595
Closed
umprayz wants to merge 8 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request aims to make the repository’s cppcheck target run clean by applying const-correctness and minor safety/cleanup edits across standalone/, mlogc/, iis/, and ext/, and by expanding the cppcheck Makefile target’s scan scope.
Changes:
- Expand the
cppcheckMakefile target to scan additional directories. - Adjust callback and helper signatures (mostly adding
const) to address cppcheck warnings. - Add/adjust a few local safety and initialization patterns to quiet analyzer findings (e.g.,
malloc()NULL handling, unused/uninit suppressions).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| standalone/api.h | Updates write callback setter prototypes to take const char *buf. |
| standalone/api.c | Updates write callback setters to take const char *buf (but currently leaves internal function-pointer types inconsistent). |
| mlogc/mlogc.c | Const-correctness tweaks, local variable scoping, and malloc-null handling in queue entry creation. |
| Makefile.am | Extends the cppcheck target to include more directories. |
| iis/mymodule.cpp | Const-correctness and initialization tweaks; updates IIS write callbacks to accept const char *buf. |
| iis/moduleconfig.h | Moves m_Config and adds a cppcheck suppression comment. |
| iis/moduleconfig.cpp | Replaces C-style casts with reinterpret_cast. |
| iis/main.cpp | Comments out a request-notification priority call (behavior change). |
| ext/mod_var_remote_addr_port.c | Makes msre_var parameters const in generator helpers. |
| ext/mod_op_strstr.c | Adds const qualifiers to operator execution params and refines Boyer–Moore implementation locals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
399
to
+404
| entry = (entry_t *)malloc(sizeof(entry_t)); | ||
| entry->id = 0; | ||
| entry->line = strdup(data); | ||
| entry->line_size = strlen(entry->line); | ||
| if(entry != NULL){ | ||
| entry->id = 0; | ||
| entry->line = strdup(data); | ||
| entry->line_size = strlen(entry->line); | ||
| } |
Comment on lines
+687
to
693
| void modsecSetWriteBody(apr_status_t (*func)(request_rec *r, const char *buf, unsigned int length)) { | ||
| modsecWriteBody = func; | ||
| } | ||
|
|
||
| void modsecSetWriteResponse(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length)) { | ||
| void modsecSetWriteResponse(apr_status_t (*func)(request_rec *r, const char *buf, unsigned int length)) { | ||
| modsecWriteResponse = func; | ||
| } |
Comment on lines
+58
to
+63
| standalone/ \ | ||
| mlogc/ \ | ||
| iis/ \ | ||
| ext/ \ | ||
| build/ \ | ||
| doc/ |
Comment on lines
460
to
462
| USHORT ctcch = 0; | ||
| char *ct = (char *)pHttpResponse->GetHeader(HttpHeaderContentType, &ctcch); | ||
| const char *ct = (char *)pHttpResponse->GetHeader(HttpHeaderContentType, &ctcch); | ||
| char *ctz = ZeroTerminate(ct, ctcch, r->pool); |
…ty into v2/cppcheck_0702_clean
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



what
iis/ext/andmlogc/directories.why
api.candapi.hfiles in thestandalone/directory, in order to resolve a warning in these two function:modsecSetWriteBody()andmodsecSetWriteResponse(). Themymodule.cppuses them in itsWriteResponseCallback()andWriteBodyCallback()functions.references
<fix: cppcheck warnings in standalone/ fix: cppcheck warnings in standalone/ #3488>