Andreas Schneider
c563ed636a
Remove vim modelines from all files
...
If you want modelines use my vim plugin:
https://github.com/cryptomilk/git-modeline.vim
git config --add vim.modeline "ts=4 sw=4 et"
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-06-28 08:41:08 +02:00
Aris Adamantiadis
36d52ee205
buffer: Add ssh_buffer_allocate() function
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-06-04 16:55:23 +02:00
Nikos Mavrogiannopoulos
3f562ee586
buffer: Do not call explicit_bzero with null arguments
...
This allows compiling and testing with undefined sanitizer.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-04-18 10:24:47 +02:00
Nikos Mavrogiannopoulos
eb796b4bbb
buffer: Do not call memcpy with null arguments
...
This allows compiling and testing with undefined sanitizer.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-04-18 10:24:42 +02:00
Andreas Schneider
87b8d232bd
buffer: Apply coding style to ssh_buffer_reinit()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-04-18 10:22:03 +02:00
Andreas Schneider
6f1f8d2bdb
buffer: Apply coding style to realloc_buffer()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-04-18 10:22:03 +02:00
Andreas Schneider
ebcff9fd63
src: Use explicit_bzero() if available on the platform
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-02-12 14:41:27 +01:00
Andreas Schneider
f0ddde4826
Fix config.h includes
...
We need stdlib.h and string.h in priv.h for free() and memset().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-10-28 14:31:37 +02:00
Andreas Schneider
68b7ca6e92
buffer: Validate the length before before memory allocation
...
Check if the size the other party sent is a valid size in the
transmitted buffer.
Thanks to Alex Gaynor for finding and reporting the issue.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-04-13 16:25:40 +02:00
Andreas Schneider
c165c396de
buffer: Create ssh_buffer_validate_length()
...
This functions allows if a given length can be obtained from the buffer.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-04-13 16:25:29 +02:00
Andreas Schneider
f21ddefedb
Revert "buffer: Create ssh_buffer_validate_length()"
...
This reverts commit 34bdc1ca78 .
2017-04-13 16:19:28 +02:00
Andreas Schneider
0cf1c85542
Revert "buffer: Validate the length before before memory allocation"
...
This reverts commit 57550e6211 .
2017-04-13 16:19:23 +02:00
Andreas Schneider
57550e6211
buffer: Validate the length before before memory allocation
...
Check if the size the other party sent is a valid size in the
transmitted buffer.
Thanks to Alex Gaynor for finding and reporting the issue.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-04-13 16:12:27 +02:00
Andreas Schneider
34bdc1ca78
buffer: Create ssh_buffer_validate_length()
...
This functions allows if a given length can be obtained from the buffer.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-04-13 16:12:27 +02:00
Andreas Schneider
166b9f7709
buffer: Use calloc to allocate a zero'ed buffer
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-02-06 09:42:49 +01:00
Fabiano Fidêncio
5c5b1aaaa7
buffer: expose ssh_buffer_get()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
6953c8ec91
buffer: expose ssh_buffer_{add,get}_data()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
58aff4495e
buffer: expose ssh_buffer_reinit()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
120d2b5333
buffer: remove ssh_buffer_get_begin()
...
Note that removing ssh_buffer_get_begin() doesn't break API
compatibility, as this functions has never been exposed (it only
has the LIBSSH_API prefix).
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
3cf72e5258
buffer: remove ssh_buffer_get_rest_len()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
05fd0acf45
buffer: do not use ssh_buffer_get_rest_len()
...
As ssh_buffer_get_len() actually calls ssh_buffer_get_rest_len(), let's
just use the first one. This is a preparatory step for removing
ssh_buffer_get_rest_len().
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
9774b1062d
buffer: make ssh_buffer_get_len() call ssh_buffer_get_rest_len()
...
This is a preparatory step for having the behavior of
ssh_buffer_get_rest_len() in the ssh_buffer_get_len() and then remove
the ssh_buffer_rest_len()
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
954341dd1f
buffer: rename ssh_buffer_get_rest() to ssh_buffer_get()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
56d0e91e10
buffer: cosmetic change in ssh_buffer_get_u8() documentation
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
d7349d04d0
buffer: fix documentation for ssh_buffer_get_u32()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
adc8c20ac1
cleanup: use ssh_ prefix in the buffer (non-static) functions
...
Having "ssh_" prefix in the functions' name will avoid possible clashes
when compiling libssh statically.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
6f60449e18
cleanup: use ssh_ prefix in the bignum (non-static) functions
...
Having "ssh_" prefix in the functions' name will avoid possible clashes
when compiling libssh statically.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Andreas Schneider
41a10699e6
buffer: Make sure we do not use u32len uninitialized
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:09:06 +01:00
Andreas Schneider
33ecff11dd
buffer: Cleanup vaargs in ssh_buffer_unpack_va()
...
CID: #1267977
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2015-05-04 17:54:01 +02:00
Aris Adamantiadis
3091025472
buffers: Fix a possible null pointer dereference
...
This is an addition to CVE-2015-3146 to fix the null pointer
dereference. The patch is not required to fix the CVE but prevents
issues in future.
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2015-04-23 10:33:52 +02:00
Aris Adamantiadis
940cb233ce
buffer: buffer_pack & unpack on non-gnu compilers
2015-02-08 18:49:32 +01:00
Andreas Schneider
ad8fa427dd
buffer: Abort if the canary is not intact in ssh_buffer_unpack()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be >
2015-02-02 17:32:34 +01:00
Andreas Schneider
de10a7754b
buffer: buffer: Improve argument checking of in ssh_buffer_pack()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be >
2015-02-02 17:32:31 +01:00
Andreas Schneider
6789170799
buffer: Abort if the canary is not intact in ssh_buffer_unpack()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be >
2015-02-02 17:32:28 +01:00
Andreas Schneider
afc9988c93
buffer: Improve argument checking in ssh_buffer_pack()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be >
2015-02-02 17:32:18 +01:00
Aris Adamantiadis
86ae6b2251
buffer: Add a secure buffer mechanism to avoid memory spills
...
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-09-07 10:36:32 +02:00
Aris Adamantiadis
2cb2587b55
buffer: Implement "t" for text in ssh_buffer_pack().
...
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-09-07 10:27:35 +02:00
Andreas Schneider
1b6375ce89
buffer: Make sure rc is initialized.
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be >
2014-08-15 12:29:11 +02:00
Aris Adamantiadis
228dc08038
bignums: detach bignum-related functions from dh.c.
...
Reviewed-by: Andreas Schneider <asn@samba.org >
2014-08-06 10:07:36 +02:00
Aris Adamantiadis
3b4b0f01ec
buffer: add a hidden canary to detect format errors
...
Reviewed-by: Andreas Schneider <asn@samba.org >
2014-08-06 09:58:52 +02:00
Aris Adamantiadis
835e34d1eb
Buffer: add ssh_buffer_(un)pack()
...
That function permits chaining of buffer values to minimize buffer handling
in packet sending code.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-08-06 09:04:34 +02:00
Andreas Schneider
cb9786b3ae
src: Rename buffer_add_data() to ssh_buffer_add_data().
2014-01-19 20:55:55 +01:00
Andreas Schneider
9c4144689d
src: Rename buffer_init to ssh_buffer_init().
2014-01-19 20:43:29 +01:00
Andreas Schneider
f61813eaea
CVE-2012-4562: Fix a possible infinite loop in buffer_reinit().
...
If needed is bigger than the highest power of two or a which fits in an
integer we will loop forever.
2012-11-14 17:36:22 +01:00
Xi Wang
ad5f306884
CVE-2012-4562: Fix multiple integer overflows in buffer-related functions.
2012-11-14 17:36:19 +01:00
Andreas Schneider
782b2e37c6
build: Fix missing struct in_addr warning.
2012-07-17 18:16:07 +02:00
Aris Adamantiadis
9a89fba332
resolve memory consumption bug
2010-10-03 13:31:02 +02:00
Aris Adamantiadis
0bc032726d
Fix prepend bug
2010-10-03 13:01:21 +02:00
Aris Adamantiadis
338a3d9b05
Removed references to ssh_buffer_get_begin
2010-10-03 12:07:00 +02:00
Aris Adamantiadis
899db7cf22
Fix #ifdef'ed erroneous debug code in buffer.c
2010-09-09 10:01:29 +02:00