1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-28 01:41:48 +03:00

buffer: Fix regression introduced by 6c7eaa and c306a6

Buffer (un)packing was broken on compilers that are not
gcc-compatible since the checks for an argument count of
-1 have been removed from ssh_buffer_(un)pack(). This
fix no longer uses GCC extensions for the __VA_NARG__
macro, but only plain C99.
Note: The macro can no longer count empty argument lists
(results in compile error) which was not needed anyway.

Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Tilo Eckert
2019-02-18 15:53:32 +01:00
committed by Andreas Schneider
parent 5a590dfb5f
commit 7caf6d2ab6
5 changed files with 3 additions and 25 deletions

View File

@ -496,10 +496,8 @@ static void *thread_buffer_pack_badformat(void *threadid)
/* with additional format */
rc = ssh_buffer_pack(buffer, "bb", b);
#ifdef HAVE_GCC_NARG_MACRO
/* We can only detect errors if we have support for NARG macros */
/* check that we detect the missing parameter */
assert_int_equal(rc, SSH_ERROR);
#endif
/* unpack with missing format */
ssh_buffer_reinit(buffer);