Skip to content

Fix wolfIP coverity#83

Open
aidangarske wants to merge 2 commits intomasterfrom
fix-coverity-2
Open

Fix wolfIP coverity#83
aidangarske wants to merge 2 commits intomasterfrom
fix-coverity-2

Conversation

@aidangarske
Copy link
Member

Description

  1. CID 1683231 — dead wscale (wolfip.c)
  2. CID 1683213 — ICMP memcpy overrun (wolfip.c)
  3. CID 1686341 — uninit buf (bsd_socket.c)
  4. CID 1683243 — dead break sendto (bsd_socket.c)
  5. CID 1683239 — dead break send (bsd_socket.c)
  6. CID 1683212 — dead break write (bsd_socket.c)
  7. CID 1683230 — atomicity (bsd_socket.c)
  8. CID 1683217 — missing lock (bsd_socket.c)
  9. CID 1683242 — setsockopt in test_eventloop_tun.c:233
  10. CID 1683242 — setsockopt in test_eventloop_tun.c:361
  11. CID 1683242 — setsockopt in ipfilter_logger.c:291
  12. CID 1683226 — resource leak (test_eventloop_tun.c)
  13. CID 1683236 — resource leak (test_eventloop_tun.c)

…212, 1683230, 1683217, 1683242 (×3 locations), 1683226, 1683236, 1683238
@aidangarske aidangarske self-assigned this Mar 20, 2026
Copilot AI review requested due to automatic review settings March 20, 2026 19:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses multiple Coverity findings across the wolfIP stack and its POSIX/test harnesses, focusing on dead code paths, buffer safety, resource cleanup, and some initialization/locking issues.

Changes:

  • Fix ICMP payload copy destination and adjust TCP receive window scaling logic based on RX buffer size.
  • Harden POSIX socket wrapper behavior by initializing buffers, refining accept state handling, and making initialization more atomic.
  • Reduce test resource leaks and silence ignored-return warnings for setsockopt(); update test randomness source.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/wolfip.c Fixes Coverity issues related to TCP WSCALE and ICMP memcpy destination.
src/port/posix/bsd_socket.c Addresses uninitialized buffer, atomicity/locking concerns, and adjusts nonblocking send paths.
src/test/test_eventloop_tun.c Adds close() calls on error paths and explicitly ignores setsockopt() return value.
src/test/ipfilter_logger.c Explicitly ignores setsockopt() return value to silence warnings.
src/test/test_ttl_expired.c Switches wolfIP_getrandom() to read from /dev/urandom instead of rand().
src/test/unit/unit_tests_api.c Adds a trailing blank line (formatting-only).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

               - return sent if progress was made
               - use PTHREAD_MUTEX_INITIALIZER instead of racy mutex_initialized guard
               - removed extra newline in unit_tests_api.c
Copy link

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #83

Scan targets checked: wolfip-bugs, wolfip-compliance, wolfip-src

No new issues found in the changed files. ✅

@aidangarske aidangarske requested a review from danielinux March 20, 2026 21:00
@aidangarske aidangarske marked this pull request as ready for review March 20, 2026 21:01
@aidangarske aidangarske requested review from Copilot and removed request for Copilot March 20, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants