diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-08-31 15:42:35 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-09-03 15:00:53 +0200 |
commit | a1b57d3b94491e0fca85513d18bd1c02b1835284 (patch) | |
tree | 0463623cbc1a05228405e069a3bd9a64c39c0e93 /src/buffer.c | |
parent | be703974e93ecb8ddf79f16485534d93be10a4e5 (diff) | |
download | libssh-a1b57d3b94491e0fca85513d18bd1c02b1835284.tar.gz libssh-a1b57d3b94491e0fca85513d18bd1c02b1835284.tar.xz libssh-a1b57d3b94491e0fca85513d18bd1c02b1835284.zip |
buffer: Use bool for secure buffer
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c index 743c9dc0..c4fdc752 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -37,6 +37,21 @@ #include "libssh/misc.h" #include "libssh/bignum.h" +/* + * Describes a buffer state + * [XXXXXXXXXXXXDATA PAYLOAD XXXXXXXXXXXXXXXXXXXXXXXX] + * ^ ^ ^ ^] + * \_data points\_pos points here \_used points here | / + * here Allocated + */ +struct ssh_buffer_struct { + bool secure; + char *data; + uint32_t used; + uint32_t allocated; + uint32_t pos; +}; + /** * @defgroup libssh_buffer The SSH buffer functions. * @ingroup libssh @@ -137,8 +152,9 @@ void ssh_buffer_free(struct ssh_buffer_struct *buffer) { * * @param[in] buffer buffer to set secure. */ -void ssh_buffer_set_secure(ssh_buffer buffer){ - buffer->secure = 1; +void ssh_buffer_set_secure(ssh_buffer buffer) +{ + buffer->secure = true; } static int realloc_buffer(struct ssh_buffer_struct *buffer, size_t needed) { |