aboutsummaryrefslogtreecommitdiff
path: root/include/libssh
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2019-01-22 13:31:07 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-01-24 17:48:08 +0100
commit6c7eaa9e12cb421233222675c978e2b404746bf0 (patch)
treefc02efd25807a6b7b831aeef2939df77d8e3347f /include/libssh
parent83d86ef6a5d0d755f2d3f2e453f61cba8a7c0d9a (diff)
downloadlibssh-6c7eaa9e12cb421233222675c978e2b404746bf0.tar.gz
libssh-6c7eaa9e12cb421233222675c978e2b404746bf0.tar.xz
libssh-6c7eaa9e12cb421233222675c978e2b404746bf0.zip
buffer: Convert argc to size_t in ssh_buffer_unpack() as well
Commit c306a693f3fb ("buffer: Use size_t for argc argument in ssh_buffer_(un)pack()") mentioned unpack in the commit log, but it only touches the pack variants. Extend the conversion to unpack. Pre-initialize the p pointer to avoid possible use before initialization in case of early argc check failure. This fixes build failure: .../libssh-0.8.6/src/buffer.c: In function 'ssh_buffer_unpack_va': .../libssh-0.8.6/src/buffer.c:1229:16: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] if (argc == -1){ ^ Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh')
-rw-r--r--include/libssh/buffer.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/libssh/buffer.h b/include/libssh/buffer.h
index 1c375343..cd2dea6a 100644
--- a/include/libssh/buffer.h
+++ b/include/libssh/buffer.h
@@ -50,11 +50,11 @@ int _ssh_buffer_pack(struct ssh_buffer_struct *buffer,
_ssh_buffer_pack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)
int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
- const char *format, int argc,
+ const char *format, size_t argc,
va_list ap);
int _ssh_buffer_unpack(struct ssh_buffer_struct *buffer,
const char *format,
- int argc,
+ size_t argc,
...);
#define ssh_buffer_unpack(buffer, format, ...) \
_ssh_buffer_unpack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)