Fix based on Coverity and Sonar audits (part 9) - #22337
Conversation
|
|
@cubic-dev-ai review this PR |
@stelfrag I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Pull request overview
This PR continues the audit-driven hardening of the netipc subsystem (split from #22299), focusing on overflow-safe sizing and safer stale-endpoint recovery paths across POSIX and Windows transports/services.
Changes:
- Add overflow-checked helpers for computing
header + payloadmessage lengths and apply them in send/receive and service buffer sizing paths. - Harden stale socket/SHM recovery by using safer filesystem checks (
lstat,O_NOFOLLOW, inode matching) before unlinking. - Add additional overflow guards when computing SHM region offsets/sizes (POSIX + Windows) and tighten a protocol encoder overflow check for 32-bit platforms.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/libnetdata/netipc/src/transport/windows/netipc_win_shm.c |
Adds extra overflow guards for SHM region offset/size calculation. |
src/libnetdata/netipc/src/transport/windows/netipc_named_pipe.c |
Introduces and uses a safe header+payload length helper in send/receive paths. |
src/libnetdata/netipc/src/transport/posix/netipc_uds.c |
Adds safe length helper and hardens stale socket recovery to avoid unsafe unlinks. |
src/libnetdata/netipc/src/transport/posix/netipc_shm.c |
Hardens stale SHM file recovery (no-follow, inode match) and adds region sizing overflow checks. |
src/libnetdata/netipc/src/service/netipc_service_win.c |
Adds safe sizing helpers and applies them to buffer sizing, send, and SHM profile setup. |
src/libnetdata/netipc/src/service/netipc_service.c |
Same as Windows service: safe sizing helpers applied to buffer sizing, send, and SHM profile setup. |
src/libnetdata/netipc/src/protocol/netipc_protocol.c |
Limits a size_t overflow guard to 32-bit/size-constrained platforms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
thiagoftsm
left a comment
There was a problem hiding this comment.
Despiste duplicate code informed by Sonarqubecloud, the PR worked as expected on Alma 9. LGTM!


Summary