openssl / openssl/openssl

Windows msys2 + mingw64, openssl 3.1 : warnings in apps/lib/s_socket.c

Open
#22,753 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triaged: bug
Dominant language
C
Stars
30.8k
Forks
11.5k
Avg merge
10m
Merged PRs (30d)
1

Description

warnings:

apps/lib/s_socket.c:141:25: warning: overflow in conversion from 'long long unsigned int' to 'int' changes value from '18446744073709551615' to '-1' [-Woverflo
]
  141 |                 *sock = INVALID_SOCKET;
      |                         ^~~~~~~~~~~~~~
apps/lib/s_socket.c:167:21: warning: overflow in conversion from 'long long unsigned int' to 'int' changes value from '18446744073709551615' to '-1' [-Woverflo
]
  167 |             *sock = INVALID_SOCKET;
      |                     ^~~~~~~~~~~~~~

indeed, on Windows, SOCKET is defined as typedef UINT_PTR SOCKET; and INVALID_SOCKET is defined as #define INVALID_SOCKET (SOCKET)(~0), while *sock is an int

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/lib/s_socket.c at lines 141 and 167, then inspect the Windows SOCKET and INVALID_SOCKET definitions involved in assigning to *sock. Confirm the fix by rebuilding the affected Windows msys2/mingw64 configuration and verifying that these overflow warnings no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.