Skip to content

Fix cross-platform compilation (Windows, macOS) and resolve buffer overflows for modern I2P destinations#30

Open
jolavillette wants to merge 6 commits into
i2p:masterfrom
jolavillette:fix/cross-platform-and-security
Open

Fix cross-platform compilation (Windows, macOS) and resolve buffer overflows for modern I2P destinations#30
jolavillette wants to merge 6 commits into
i2p:masterfrom
jolavillette:fix/cross-platform-and-security

Conversation

@jolavillette
Copy link
Copy Markdown

This Pull Request consolidates multiple critical fixes to make libsam3 fully cross-platform, secure, and compatible with the modern I2P network.

🛠️ Key Changes

  1. Cross-Platform Compilation (Windows & macOS)
  • Windows compatibility: Fixed header inclusion order to prevent conflicts (e.g., <winsock2.h> vs <windows.h>). Corrected socket types (SOCKET vs int) and format strings for proper MinGW/MSVC support.
  • Non-blocking sockets: Replaced Unix-specific fcntl(..., F_SETFL, O_NONBLOCK) with the correct ioctlsocket(..., FIONBIO, ...) implementation on Windows.
  • macOS support: Resolved compilation and linkage errors specific to Apple Clang and Darwin environments.
  1. Security & Modern I2P Destinations
  • Addressed critical buffer overflows that occurred when handling modern, larger I2P destination keys (which have grown due to newer crypto like Ed25519).
  • Increased static buffer sizes and strengthened boundary checks to prevent memory corruption and ensure safe communication with current I2P routers.

🧪 Testing

  • Windows: Compilation verified using MSYS2/MinGW. Network sockets operate correctly in non-blocking mode.
  • macOS: Compilation verified using Apple Clang.
  • Linux: Standard build remains fully functional without regressions.

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.

1 participant