wolfSSH_get_fd: return socket sentinel on NULL

- Return -1 on both (Windows build and not), the sentinel wolfSSH_new()
  uses for rfd/wfd.
pull/1235/head
John Safranek 2026-07-17 17:43:13 -07:00 committed by Paul Adelsbach
parent ae81d4d857
commit ed633eac0c
1 changed files with 4 additions and 1 deletions

View File

@ -258,10 +258,13 @@ WS_SOCKET_T wolfSSH_get_fd(const WOLFSSH* ssh)
if (ssh)
return ssh->rfd;
/* Return the same invalid-socket sentinel wolfSSH_new() initializes
* rfd/wfd to, rather than an error enum, so callers get a value of the
* socket type they can compare against. */
#ifdef USE_WINDOWS_API
return INVALID_SOCKET;
#else
return WS_BAD_ARGUMENT;
return -1;
#endif
}