Repository navigation
Conversation
``` src/misc.c:519:24: warning: implicit conversion loses integer precision: '__darwin_time_t' (aka 'long') to 'int' [-Wshorten-64-to-32] src/session.c:665:52: warning: implicit conversion loses integer precision: 'long' to '__darwin_suseconds_t' (aka 'int') [-Wshorten-64-to-32] ```
``` src/kex.c:1719:..: warning C4701: potentially uninitialized local variable 'type' used src/kex.c:2303:15: warning: 'type' may be used uninitialized [-Wmaybe-uninitialized] src/openssl.c:207:..: warning C4701: potentially uninitialized local variable 'nid_type' used src/openssl.c:208:..: warning C4701: potentially uninitialized local variable 'nid_type' used src/openssl.c:355:..: warning C4701: potentially uninitialized local variable 'type' used src/sftp.c:1201:25: warning: 'data_len' may be used uninitialized [-Wmaybe-uninitialized] src/sftp.c:1202:30: warning: 'data' may be used uninitialized [-Wmaybe-uninitialized] ```
``` src/libgcrypt.c:650:6: warning: no previous prototype for '_libssh2_init_aes_ctr' [-Wmissing-prototypes] src/libgcrypt.c:650:6: warning: no previous prototype for function '_libssh2_init_aes_ctr' [-Wmissing-prototypes] src/mbedtls.c:833:6: warning: no previous prototype for '_libssh2_init_aes_ctr' [-Wmissing-prototypes] src/mbedtls.c:833:6: warning: no previous prototype for function '_libssh2_init_aes_ctr' [-Wmissing-prototypes] ```
```
src/agent.c:314:..: warning C4267: '=': conversion from 'size_t' to 'DWORD', possible loss of data
src/agent.c:314:18: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'DWORD' {aka 'long unsigned int'} may change value [-Wconversion]
src/agent.c:314:20: warning: implicit conversion loses integer precision: 'unsigned long long' to 'DWORD' (aka 'unsigned long') [-Wshorten-64-to-32]
src/wincng.c:671:..: warning C4267: 'function': conversion from 'size_t' to 'ULONG', possible loss of data
src/wincng.c:671:39: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'ULONG' {aka 'long unsigned int'} may change value [-Wconversion]
src/wincng.c:671:39: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'ULONG' (aka 'unsigned long') [-Wshorten-64-to-32]
src/wincng.c:2552:33: warning: conversion from 'long long unsigned int' to 'DWORD' {aka 'long unsigned int'} may change value [-Warith-conversion]
```
```
src/kex.c:3959:..: warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
src/kex.c:3959:21: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
src/kex.c:3959:21: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
src/kex.c:3959:21: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
src/kex.c:3959:21: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
```
```
src/blowfish.c:549:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:553:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:571:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:575:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:595:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:599:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:621:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:625:19: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:637:15: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
src/blowfish.c:641:15: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
```
``` src/misc.c:348:25: warning: conversion from 'int' to 'unsigned char' may change value [-Wconversion] src/misc.c:352:25: warning: conversion from 'int' to 'unsigned char' may change value [-Wconversion] src/misc.c:356:25: warning: conversion from 'int' to 'unsigned char' may change value [-Wconversion] ```
```
src/scp.c:301:..: warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
src/scp.c:301:19: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
src/scp.c:301:19: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
src/scp.c:301:19: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
src/scp.c:301:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
src/scp.c:860:..: warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
src/scp.c:860:19: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
src/scp.c:860:19: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
src/scp.c:860:19: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
src/scp.c:860:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
```
```
src/scp.c:261:..: warning C4244: 'return': conversion from '__int64' to 'unsigned int', possible loss of data
src/scp.c:261:16: warning: conversion from 'long int' to 'unsigned int' may change value [-Wconversion]
src/scp.c:261:16: warning: conversion from 'long long int' to 'unsigned int' may change value [-Wconversion]
src/scp.c:261:16: warning: implicit conversion loses integer precision: 'long long' to 'unsigned int' [-Wshorten-64-to-32]
src/scp.c:261:16: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
src/scp.c:304:..: warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
src/scp.c:304:64: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/scp.c:304:64: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/scp.c:304:64: warning: implicit conversion loses integer precision: 'unsigned long long' to 'unsigned int' [-Wshorten-64-to-32]
src/scp.c:304:64: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
src/scp.c:863:..: warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
src/scp.c:863:64: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/scp.c:863:64: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/scp.c:863:64: warning: implicit conversion loses integer precision: 'unsigned long long' to 'unsigned int' [-Wshorten-64-to-32]
src/scp.c:863:64: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
```
```
src/agent.c:153:19: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
src/agent.c:153:19: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
src/agent.c:160:19: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
src/agent.c:160:19: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
src/agent.c:174:14: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
src/agent.c:174:14: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
src/agent.c:186:14: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
src/agent.c:186:14: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
src/agent.c:198:14: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
src/agent.c:198:14: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
src/agent.c:217:14: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
src/agent.c:217:14: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
```
vszakats
force-pushed
the
silence-warnings-1-1
branch
2 times, most recently
from
March 26, 2023 00:41
25845e2 to
9b3ab77
Compare
VS2015, OpenSSL, Shared: ``` c:\projects\libssh2\src\publickey.c(291): warning C4702: unreachable code ``` Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46504603/job/pb8gutsrqohot9ef#L175
``` C:\projects\libssh2\src\misc.c(83): warning C4018: '<' : signed/unsigned mismatch [C:\projects\libssh2\_builds\src\libssh2.vcxproj] C:\projects\libssh2\src\misc.c(83): warning C4018: '<' : signed/unsigned mismatch [C:\projects\libssh2\_builds\tests\test_keyboard_interactive_auth_info_request.vcxproj] ```
``` src/kex.c:1431:..: warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data src/kex.c:1559:..: warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data ```
``` src/kex.c:4046:..: warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data ```
```
src/knownhost.c:173:..: warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
src/knownhost.c:173:42: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/knownhost.c:173:42: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/knownhost.c:173:42: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'unsigned int' [-Wshorten-64-to-32]
src/knownhost.c:173:42: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
src/knownhost.c:180:..: warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
src/knownhost.c:180:42: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/knownhost.c:180:42: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/knownhost.c:180:42: warning: implicit conversion loses integer precision: 'unsigned long long' to 'unsigned int' [-Wshorten-64-to-32]
src/knownhost.c:180:42: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
src/pem.c:394:..: warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
src/pem.c:394:39: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/pem.c:394:39: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Wconversion]
src/pem.c:394:39: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'unsigned int' [-Wshorten-64-to-32]
src/pem.c:394:39: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
src/userauth.c:614:..: warning C4244: 'function': conversion from '__int64' to 'unsigned int', possible loss of data
src/userauth.c:614:49: warning: conversion from 'long int' to 'unsigned int' may change value [-Wconversion]
src/userauth.c:614:49: warning: conversion from 'long long int' to 'unsigned int' may change value [-Wconversion]
src/userauth.c:614:49: warning: implicit conversion loses integer precision: 'long long' to 'unsigned int' [-Wshorten-64-to-32]
src/userauth.c:614:49: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
src/userauth.c:718:..: warning C4244: 'function': conversion from '__int64' to 'unsigned int', possible loss of data
src/userauth.c:718:49: warning: conversion from 'long int' to 'unsigned int' may change value [-Wconversion]
src/userauth.c:718:49: warning: conversion from 'long long int' to 'unsigned int' may change value [-Wconversion]
src/userauth.c:718:49: warning: implicit conversion loses integer precision: 'long long' to 'unsigned int' [-Wshorten-64-to-32]
src/userauth.c:718:49: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
```
``` src/misc.c:83:..: warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data ```
It's an unused arg on that platform.
```
src/session.c:679:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
src/session.c:679:40: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
src/session.c:679:40: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
src/session.c:1771:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
src/session.c:1771:35: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
src/session.c:1771:35: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
```
```
src/bcrypt_pbkdf.c:91:26: warning: conversion from ‘uint32_t’ {aka ‘unsigned int’} to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Wconversion]
91 | out[4 * i + 3] = (cdata[i] >> 24) & 0xff;
| ^
src/bcrypt_pbkdf.c: In function ‘bcrypt_pbkdf’:
src/bcrypt_pbkdf.c:139:34: warning: conversion from ‘uint32_t’ {aka ‘unsigned int’} to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Wconversion]
139 | countsalt[saltlen + 0] = (count >> 24) & 0xff;
| ^
```
```
/home/runner/work/libssh2/libssh2/src/blowfish.c: In function ‘Blowfish_expand0state’:
/home/runner/work/libssh2/libssh2/src/blowfish.c:442:36: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Warith-conversion]
442 | for(i = 0; i < BLF_N + 2; i += 2) {
| ^
/home/runner/work/libssh2/libssh2/src/blowfish.c:450:34: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Warith-conversion]
450 | for(k = 0; k < 256; k += 2) {
| ^
/home/runner/work/libssh2/libssh2/src/blowfish.c: In function ‘Blowfish_expandstate’:
/home/runner/work/libssh2/libssh2/src/blowfish.c:481:36: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Warith-conversion]
481 | for(i = 0; i < BLF_N + 2; i += 2) {
| ^
/home/runner/work/libssh2/libssh2/src/blowfish.c:491:34: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Warith-conversion]
491 | for(k = 0; k < 256; k += 2) {
| ^
```
gcc
```
src/session.c: In function ‘_libssh2_wait_socket’:
src/session.c:658:53: warning: conversion from ‘long int’ to ‘int’ may change value [-Wconversion]
658 | rc = poll(sockets, 1, has_timeout?ms_to_next: -1);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
src/session.c:1717:42: warning: conversion from ‘long int’ to ‘int’ may change value [-Wconversion]
1717 | sysret = poll(sockets, nfds, timeout_remaining);
| ^~~~~~~~~~~~~~~~~
```
clang
```
src/session.c:658:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
rc = poll(sockets, 1, has_timeout?ms_to_next: -1);
~~~~ ^~~~~~~~~~
src/session.c:1717:42: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
sysret = poll(sockets, nfds, timeout_remaining);
~~~~ ^~~~~~~~~~~~~~~~~
```
``` src/kex.c:3761:44: warning: conversion from 'unsigned char' to 'unsigned char:1' may change value [-Wconversion] ```
gcc
```
src/session.c: In function ‘libssh2_poll’:
src/session.c:1550:33: warning: conversion from ‘long unsigned int’ to ‘short int’ may change value [-Wconversion]
1550 | sockets[i].events = fds[i].events;
| ^~~
```
clang
```
src/session.c:1550:40: warning: implicit conversion loses integer precision: 'unsigned long' to 'short' [-Wimplicit-int-conversion]
sockets[i].events = fds[i].events;
~ ~~~~~~~^~~~~~
```
vszakats
force-pushed
the
silence-warnings-1-1
branch
from
March 26, 2023 00:50
9b3ab77 to
3c48bc3
Compare
This was referenced Mar 26, 2023
vszakats
added a commit
that referenced
this pull request
Mar 26, 2023
Apply type changes to avoid casts and warnings. In most cases this means changing to a larger type, usually `size_t` or `ssize_t`. Change signedness in a few places. Also introduce new variables to avoid reusing them for multiple purposes, to avoid casts and warnings. - add FIXME for public `libssh2_sftp_readdir_ex()` return type. - fix `_libssh2_mbedtls_rsa_sha2_verify()` to verify if `sig_len` is large enough. - fix `_libssh2_dh_key_pair()` in `wincng.c` to return error if `group_order` input is negative. Maybe we should also reject zero? - bump `_libssh2_random()` size type `int` -> `size_t`. Add checks for WinCNG and OpenSSL to return error if requested more than they support (`ULONG_MAX`, `INT_MAX` respectively). - change `_libssh2_ntohu32()` return value `unsigned int` -> `uint32_t`. - fix `_libssh2_mbedtls_bignum_random()` to check for a negative `top` input. - size down `_libssh2_wincng_key_sha_verify()` `hashlen` to match Windows'. - fix `session_disconnect()` to limit length of `lang_len` (to 256 bytes). - fix bad syntax in an `assert()`. - add a few `const` to casts. - `while(1)` -> `for(;;)`. - add casts that didn't fit into #876. - update `docs/HACKING-CRYPTO` with new sizes. May need review for OS400QC3: /cc @monnerat @jonrumsey See warning details in the PR's individual commits. Cherry-picked from #846 Closes #879
vszakats
added a commit
to vszakats/libssh2
that referenced
this pull request
Jun 5, 2023
Simplify the code to avoid this warning. This might also help to avoid this with other compilers. Improves 02f2700 libssh2#876 Might fix libssh2#1083 Closes libssh2#1086
vszakats
added a commit
that referenced
this pull request
Jun 6, 2023
vszakats
added a commit
that referenced
this pull request
Jun 13, 2023
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Jul 16, 2023
Simplify the code to avoid this warning. This might also help avoiding it with other compilers (e.g. gcc?). Improves 02f2700 libssh2#876 Might fix libssh2#1083 Closes libssh2#1086
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Jul 16, 2023
Before 02f2700 libssh2#846 libssh2#876, we used `%I64d'. That patch changed this to `%lld`. This patch uses `PRId64` (defined in `inttypes.h`). Fixes libssh2#1090 Closes libssh2#1091
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Most of the changes aim to silence warnings by adding casts.
An assortment of other issues, mainly compiler warnings, resolved:
- unreachable code fixed by using `goto` in
`publickey_response_success()` in `publickey.c`.
- potentially uninitialized variable in `sftp_open()`.
- MSVS-specific bogus warnings with `nid_type` in `kex.c`.
- check result of `kex_session_ecdh_curve_type()`.
- add missing function declarations.
- type changes to fit values without casts:
- `cmd_len` in `scp_recv()` and `scp_send()`: `int` -> `size_t`
- `Blowfish_expandstate()`, `Blowfish_expand0state()` loop counters:
`uint16_t` -> `int`
- `RECV_SEND_ALL()`: `int` -> `ssize_t`
- `shell_quotearg()` -> `unsigned` -> `size_t`
- `sig_len` in `_libssh2_mbedtls_rsa_sha2_sign()`:
`unsigned` -> `size_t`
- `prefs_len` in `libssh2_session_method_pref()`: `int` -> `size_t`
- `firstsec` in `_libssh2_debug_low()`: `int` -> `long`
- `method_len` in `libssh2_session_method_pref()`: `int` -> `size_t`
- simplify `_libssh2_ntohu64()`.
- fix `LIBSSH2_INT64_T_FORMAT` for MinGW.
- fix gcc warning by not using a bit field for
`burn_optimistic_kexinit`.
- fix unused variable warning in `_libssh2_cipher_crypt()` in
`libgcrypt.c`.
- fix unused variables with `HAVE_DISABLED_NONBLOCKING`.
- avoid const stripping with `BIO_new_mem_buf()` and OpenSSL 1.0.2 and
newer.
- add a missing const in `wincng.h`.
- FIXME added for public:
- `libssh2_channel_window_read_ex()` `read_avail` argument type.
- `libssh2_base64_decode()` `datalen` argument type.
- fix possible overflow in `sftp_read()`.
Ref: 4552c73
- formatting in `wincng.h`.
See warning details in the PR's individual commits.
Cherry-picked from libssh2#846
Closes libssh2#876
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Apply type changes to avoid casts and warnings. In most cases this means changing to a larger type, usually `size_t` or `ssize_t`. Change signedness in a few places. Also introduce new variables to avoid reusing them for multiple purposes, to avoid casts and warnings. - add FIXME for public `libssh2_sftp_readdir_ex()` return type. - fix `_libssh2_mbedtls_rsa_sha2_verify()` to verify if `sig_len` is large enough. - fix `_libssh2_dh_key_pair()` in `wincng.c` to return error if `group_order` input is negative. Maybe we should also reject zero? - bump `_libssh2_random()` size type `int` -> `size_t`. Add checks for WinCNG and OpenSSL to return error if requested more than they support (`ULONG_MAX`, `INT_MAX` respectively). - change `_libssh2_ntohu32()` return value `unsigned int` -> `uint32_t`. - fix `_libssh2_mbedtls_bignum_random()` to check for a negative `top` input. - size down `_libssh2_wincng_key_sha_verify()` `hashlen` to match Windows'. - fix `session_disconnect()` to limit length of `lang_len` (to 256 bytes). - fix bad syntax in an `assert()`. - add a few `const` to casts. - `while(1)` -> `for(;;)`. - add casts that didn't fit into libssh2#876. - update `docs/HACKING-CRYPTO` with new sizes. May need review for OS400QC3: /cc @monnerat @jonrumsey See warning details in the PR's individual commits. Cherry-picked from libssh2#846 Closes libssh2#879
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Simplify the code to avoid this warning. This might also help avoiding it with other compilers (e.g. gcc?). Improves 02f2700 libssh2#876 Might fix libssh2#1083 Closes libssh2#1086
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Before 02f2700 libssh2#846 libssh2#876, we used `%I64d'. That patch changed this to `%lld`. This patch uses `PRId64` (defined in `inttypes.h`). Fixes libssh2#1090 Closes libssh2#1091
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most of the changes aim to silence warnings by adding casts.
An assortment of other issues, mainly compiler warnings, resolved:
gotoinpublickey_response_success()inpublickey.c.sftp_open().nid_typeinkex.c.kex_session_ecdh_curve_type().cmd_leninscp_recv()andscp_send():int→size_tBlowfish_expandstate(),Blowfish_expand0state()loop counters:uint16_t→intRECV_SEND_ALL():int→ssize_tshell_quotearg()→unsigned→size_tsig_lenin_libssh2_mbedtls_rsa_sha2_sign():unsigned→size_tprefs_leninlibssh2_session_method_pref():int→size_tfirstsecin_libssh2_debug_low():int→longmethod_leninlibssh2_session_method_pref():int→size_t_libssh2_ntohu64().LIBSSH2_INT64_T_FORMATfor MinGW.burn_optimistic_kexinit._libssh2_cipher_crypt()inlibgcrypt.c.HAVE_DISABLED_NONBLOCKING.BIO_new_mem_buf()and OpenSSL 1.0.2 and newer.wincng.h.libssh2_channel_window_read_ex()read_availargument type.libssh2_base64_decode()datalenargument type.wincng.h.See warning details in the PR's individual commits.
Cherry-picked from #846
Closes #876
Partial list of warnings fixed:
gcc:
clang:
gcc:
clang:
gcc:
gcc: (clang was OK)
clang:
VS2015, OpenSSL, Shared:
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46504603/job/pb8gutsrqohot9ef#L175