1
1

2097 Коммитов

Автор SHA1 Сообщение Дата
hlefebvre
92f76866a8 misc.c : Add an EWOULDBLOCK check for better portability (#172)
File: misc.c

Notes: Added support for all OS' that implement EWOULDBLOCK, not only VMS

Credit: hlefebvre
2019-07-30 15:50:25 -07:00
Etienne Samson
4820556950 userauth.c: fix off by one error when loading public keys with no id (#386)
File: userauth.c

Credit: 
Etienne Samson

Notes: 
Caught by ASAN:

=================================================================
==73797==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700001bcf0 at pc 0x00010026198d bp 0x7ffeefbfed30 sp 0x7ffeefbfe4d8
READ of size 69 at 0x60700001bcf0 thread T0
2019-07-04 08:35:30.292502+0200 atos[73890:2639175] examining /Users/USER/*/libssh2_clar [73797]
    #0 0x10026198c in wrap_memchr (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x1f98c)
    #1 0x1000f8e66 in file_read_publickey userauth.c:633
    #2 0x1000f2dc9 in userauth_publickey_fromfile userauth.c:1513
    #3 0x1000f2948 in libssh2_userauth_publickey_fromfile_ex userauth.c:1590
    #4 0x10000e254 in test_userauth_publickey__ed25519_auth_ok publickey.c:69
    #5 0x1000090c3 in clar_run_test clar.c:260
    #6 0x1000038f3 in clar_run_suite clar.c:343
    #7 0x100003272 in clar_test_run clar.c:522
    #8 0x10000c3cc in main runner.c:60
    #9 0x7fff5b43b3d4 in start (libdyld.dylib:x86_64+0x163d4)

0x60700001bcf0 is located 0 bytes to the right of 80-byte region [0x60700001bca0,0x60700001bcf0)
allocated by thread T0 here:
    #0 0x10029e053 in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5c053)
    #1 0x1000b4978 in libssh2_default_alloc session.c:67
    #2 0x1000f8aba in file_read_publickey userauth.c:597
    #3 0x1000f2dc9 in userauth_publickey_fromfile userauth.c:1513
    #4 0x1000f2948 in libssh2_userauth_publickey_fromfile_ex userauth.c:1590
    #5 0x10000e254 in test_userauth_publickey__ed25519_auth_ok publickey.c:69
    #6 0x1000090c3 in clar_run_test clar.c:260
    #7 0x1000038f3 in clar_run_suite clar.c:343
    #8 0x100003272 in clar_test_run clar.c:522
    #9 0x10000c3cc in main runner.c:60
    #10 0x7fff5b43b3d4 in start (libdyld.dylib:x86_64+0x163d4)

SUMMARY: AddressSanitizer: heap-buffer-overflow (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x1f98c) in wrap_memchr
Shadow bytes around the buggy address:
  0x1c0e00003740: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fd fd
  0x1c0e00003750: fd fd fd fd fd fd fd fa fa fa fa fa 00 00 00 00
  0x1c0e00003760: 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 00 00
  0x1c0e00003770: 00 00 00 fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x1c0e00003780: fd fd fa fa fa fa fd fd fd fd fd fd fd fd fd fa
=>0x1c0e00003790: fa fa fa fa 00 00 00 00 00 00 00 00 00 00[fa]fa
  0x1c0e000037a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0e000037b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0e000037c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0e000037d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0e000037e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
2019-07-15 15:49:47 -07:00
Thilo Schulz
d333e539f8 openssl.c : Fix use-after-free crash on reinitialization of openssl backend
file : openssl.c

notes : 
libssh2's openssl backend has a use-after-free condition if HAVE_OPAQUE_STRUCTS is defined and you call libssh2_init() again after prior initialisation/deinitialisation of libssh2

credit : Thilo Schulz
2019-07-12 09:56:55 -07:00
axjowa
ff2bce3057 openssl.h : Use of ifdef where if should be used (#389)
File : openssl.h

Notes : 
LIBSSH2_ECDSA and LIBSSH2_ED25519 are always defined so the #ifdef
checks would never be false.

This change makes it possible to build libssh2 against OpenSSL built
without EC support.

Change-Id: I0a2f07c2d80178314dcb7d505d1295d19cf15afd

Credit : axjowa
2019-07-12 09:55:09 -07:00
Zenju
81b2548fef Agent.c : Preserve error info from agent_list_identities() (#374)
Files : agent.c

Notes : 
Currently the error details as returned by agent_transact_pageant() are overwritten by a generic "agent list id failed" message by int agent_list_identities(LIBSSH2_AGENT* agent).

Credit :
Zenju
2019-07-01 15:01:13 -07:00
Who? Me?!
bc564e9167 Channel.c: Make sure the error code is set in _libssh2_channel_open() (#381)
File : Channel.c

Notes :
if _libssh2_channel_open() fails, set the error code.

Credit : 
mark-i-m
2019-07-01 10:03:06 -07:00
Orgad Shaneh
7d2c21c527 Kex.c, Remove unneeded call to strlen (#373)
File : Kex.c

Notes : 
Removed call to strlen

Credit : 
Orgad Shaneh
2019-07-01 10:01:04 -07:00
Pedro Monreal
f4663f9f12 Spelling corrections (#380)
Files : 
libssh2.h, libssh2_sftp.h, bcrypt_pbkdf.c, mbedtls.c, sftp.c, ssh2.c

Notes :
* Fixed misspellings

Credit :
Pedro Monreal
2019-07-01 10:00:09 -07:00
Sebastián Katzer
fd8b28658d Fix Potential typecast error for _libssh2_ecdsa_key_get_curve_type (#383)
Issue : #383 

Files : hostkey.c, crypto.h, openssl.c

Notes : 
* Fix potential typecast error for `_libssh2_ecdsa_key_get_curve_type`
* Rename _libssh2_ecdsa_key_get_curve_type to _libssh2_ecdsa_get_curve_type

Credit : 
Sebastián Katzer
2019-07-01 09:58:05 -07:00
Will Cosgrove
53ff2e6da4
bump copyright date 2019-06-20 10:47:44 -07:00
Will Cosgrove
42d37aa631
1.9 Formatting 2019-06-19 11:11:28 -07:00
Will Cosgrove
caf0504018
1.9 Release notes 2019-06-19 11:10:35 -07:00
Alexander Curtiss
86e52ba63c libgcrypt.c : Fixed _libssh2_rsa_sha1_sign memory leak. (#370)
File: libgcrypt.c

Notes : Added calls to gcry_sexp_release to free memory allocated by gcry_sexp_find_token

Credit : 
Reporter : beckmi
PR by: Alexander Curtiss
2019-05-17 10:05:16 -07:00
Orivej Desh
1130615eeb libssh2_priv.h : Fix musl build warning on sys/poll.h (#346)
File : libssh2_priv.h

Notes :
musl prints `redirecting incorrect #include <sys/poll.h> to <poll.h>`
http://git.musl-libc.org/cgit/musl/commit/include/sys/poll.h?id=54446d730cfb17c5f7bcf57f139458678f5066cc

poll is defined by POSIX to be in poll.h:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.html

Credit : Orivej Desh
2019-05-08 15:26:31 -07:00
Will Cosgrove
16f2d2bf86
kex.c : additional bounds checks in diffie_hellman_sha1/256 (#361)
Files : kex.c, misc.c, misc.h

Notes :
Fixed possible out of bounds memory access when reading malformed data in diffie_hellman_sha1() and diffie_hellman_sha256().

Added _libssh2_copy_string() to misc.c to return an allocated and filled char buffer from a string_buf offset. Removed no longer needed s var in kmdhgGPshakex_state_t.
2019-05-01 16:45:13 -07:00
Tseng Jun
dd74f2465b sftp.c : sftp_bin2attr() Correct attrs->gid assignment (#366)
Regression with fix for #339

Credit : Tseng Jun
2019-04-26 10:05:32 -07:00
Tseng Jun
460fe32f7d kex.c : Correct type cast in curve25519_sha256() (#365) 2019-04-25 09:55:56 -07:00
Will Cosgrove
934537c449
transport.c : scope local total_num var (#364)
file : transport.c
notes : move local `total_num` variable inside of if block to prevent scope access issues which caused #360.
2019-04-24 13:26:04 -07:00
doublex
f5e84ae241 transport.c : fixes bounds check if partial packet is read
Files : transport.c

Issue : #360

Notes : 
 'p->total_num' instead of local value total_num when doing bounds check.

Credit : Doublex
2019-04-24 09:55:59 -07:00
Will Cosgrove
1cdbe63d0c
Editor config file for source files (#322)
Simple start to an editor config file when editing source files to make sure they are configured correctly.
2019-04-23 10:30:12 -07:00
Will Cosgrove
8ab5c36a32
misc.c : String buffer API improvements (#332)
Files : misc.c, hostkey.c, kex.c, misc.h, openssl.c, sftp.c

Notes : 
* updated _libssh2_get_bignum_bytes and _libssh2_get_string. Now pass in length as an argument instead of returning it to keep signedness correct. Now returns -1 for failure, 0 for success.

_libssh2_check_length now returns 0 on success and -1 on failure to match the other string_buf functions. Added comment to _libssh2_check_length.

Credit : Will Cosgrove
2019-04-23 10:28:01 -07:00
doublex
a19d85319d mbedtls.c : _libssh2_mbedtls_rsa_new_private_frommemory() allow private-key from memory (#359)
File : mbedtls.c

Notes: _libssh2_mbedtls_rsa_new_private_frommemory() fixes private-key from memory reading to by adding NULL terminator before parsing; adds passphrase support.

Credit: doublex
2019-04-19 14:26:03 -07:00
Ryan Kelley
9d13d86627 Session.c : banner_receive() from leaking when accessing non ssh ports (#356)
File : session.c

Release previous banner in banner_receive() if the session is reused after a failed connection.

Credit : Ryan Kelley
2019-04-17 17:18:11 -07:00
Will Cosgrove
2b45dfcad7
Formatting in agent.c
Removed whitespace.
2019-04-11 12:12:19 -07:00
Will Cosgrove
12343f11da
Fixed formatting in agent.c
Quiet linter around a couple if blocks and pointer.
2019-04-11 12:08:43 -07:00
Zhen-Huan HWANG
9ea7d3bced sftp.c : discard and reset oversized packet in sftp_packet_read() (#269)
file : sftp.c

notes : when sftp_packet_read() encounters an sftp packet which exceeds SFTP max packet size it now resets the reading state so it can continue reading.

credit : Zhen-Huan HWANG
2019-04-11 10:17:18 -07:00
Will Cosgrove
dce4d8c742
Add agent functions libssh2_agent_get_identity_path() and libssh2_agent_set_identity_path() (#308)
File : agent.c

Notes : 
Libssh2 uses the SSH_AUTH_SOCK env variable to read the system agent location. However, when using a custom agent path you have to set this value using setenv which is not thread-safe. The new functions allow for a way to set a custom agent socket path in a thread safe manor.
2019-04-11 10:11:38 -07:00
Will Cosgrove
ff1b155731
Simplified _libssh2_check_length (#350)
* Simplified _libssh2_check_length

misc.c : _libssh2_check_length()

Removed cast and improved bounds checking and format.

Credit : Yuriy M. Kaminskiy
2019-04-05 09:46:03 -07:00
Will Cosgrove
c07bc647f2
_libssh2_check_length() : additional bounds check (#348)
Misc.c : _libssh2_check_length()

Ensure the requested length is less than the total length before doing the additional bounds check
2019-04-01 13:30:50 -07:00
Daniel Stenberg
38bf7ce9ec
misc: remove 'offset' from string_buf
It isn't necessary.

Closes #343
2019-03-25 20:26:04 +01:00
Daniel Stenberg
38818082c1
sftp: repair mtime from e1ead35e475
A regression from e1ead35e4759 broke the SFTP mtime logic in
sftp_bin2attr

Also simplified the _libssh2_get_u32/u64 functions slightly.

Closes #342
2019-03-25 08:20:01 +01:00
Daniel Stenberg
87fc75b23d
session_disconnect: don't zero state, just clear the right bit
If we clear the entire field, the freeing of data in session_free() is
skipped. Instead just clear the bit that risk making the code get stuck
in the transport functions.

Regression from 4d66f6762ca3fc45d9.

Reported-by: dimmaq on github
Fixes #338
Closes #340
2019-03-24 12:35:27 +01:00
Daniel Stenberg
e1ead35e47
libssh2_sftp.h: restore broken ABI
Commit 41fbd44 changed variable sizes/types in a public struct which
broke the ABI, which breaks applications!

This reverts that change.

Closes #339
2019-03-24 00:26:12 +01:00
Daniel Stenberg
452517d96c
style: make includes and examples code style strict
make travis and the makefile rule verify them too

Closes #334
2019-03-21 13:04:07 +01:00
Daniel Stenberg
4186a04cfd
create a github issue template 2019-03-21 09:30:41 +01:00
Daniel Stenberg
3d7e0232d8
stale-bot: activated
The stale bot will automatically mark stale issues (inactive for 90
days) and if still untouched after 21 more days, close them.

See https://probot.github.io/apps/stale/
2019-03-21 09:25:50 +01:00
Daniel Stenberg
fb4cc5cb1f
libssh2_session_supported_algs.3: fix formatting mistakes
Reported-by: Max Horn
Fixes #57
2019-03-20 23:50:42 +01:00
Zenju
c3d89b9720
libssh2.h: Fix Error C2371 'ssize_t': redefinition
Closes #331
2019-03-20 22:43:09 +01:00
Daniel Stenberg
1b3cbaff51
travis: add code style check
Closes #324
2019-03-20 15:20:54 +01:00
Daniel Stenberg
12bddb0d45
code style: unify code style
Indent-level: 4
Max columns: 79
No spaces after if/for/while
Unified brace positions
Unified white spaces
2019-03-20 14:21:38 +01:00
Daniel Stenberg
76f1e8735b
src/checksrc.pl: code style checker
imported as-is from curl
2019-03-20 14:09:37 +01:00
Will Cosgrove
f6a8d1202c Merge branch 'MichaelBuckley-michaelbuckley-security-fixes' 2019-03-19 15:18:50 -07:00
Will Cosgrove
c9008ca66d Silence unused var warnings (#329)
Silence warnings about unused variables in this test
2019-03-19 15:17:59 -07:00
Will Cosgrove
1e2b63cbff Removed unneeded > 0 check
When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above zero.
2019-03-19 15:17:59 -07:00
Matthew D. Fuller
78fdc41c56 Spell OpenSS_H_ right when talking about their specific private key (#321)
Good catch, thanks.
2019-03-19 15:17:59 -07:00
Will Cosgrove
4ac1ba7181
Silence unused var warnings (#329)
Silence warnings about unused variables in this test
2019-03-19 14:14:34 -07:00
Michael Buckley
9ae4b9e949 Fix more scope and printf warning errors 2019-03-19 10:17:20 -07:00
Michael Buckley
01c67b2e4d Silence unused variable warning 2019-03-19 10:06:42 -07:00
Will Cosgrove
088b376ccd
Removed unneeded > 0 check
When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above zero.
2019-03-19 09:57:30 -07:00
Matthew D. Fuller
d47af1bfc7 Spell OpenSS_H_ right when talking about their specific private key (#321)
Good catch, thanks.
2019-03-19 09:41:24 -07:00