diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-09-27 15:52:28 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-10-24 09:48:35 +0200 |
commit | 12ec1fed2f236eae8f4de3c17781b4da4bac0fcb (patch) | |
tree | 1432f4b1900a7b7934c180048b8315b561b1ea34 /examples | |
parent | fb70d0fb41ac51d6d8e4a4de23b3cc72beae1329 (diff) | |
download | libssh-12ec1fed2f236eae8f4de3c17781b4da4bac0fcb.tar.gz libssh-12ec1fed2f236eae8f4de3c17781b4da4bac0fcb.tar.xz libssh-12ec1fed2f236eae8f4de3c17781b4da4bac0fcb.zip |
examples: Zero fds in sshnetcat
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/examples_common.h | 4 | ||||
-rw-r--r-- | examples/sshnetcat.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/examples/examples_common.h b/examples/examples_common.h index 13eb455c..d3f4e1aa 100644 --- a/examples/examples_common.h +++ b/examples/examples_common.h @@ -14,6 +14,10 @@ clients must be made or how a client should react. #define EXAMPLES_COMMON_H_ #include <libssh/libssh.h> + +/** Zero a structure */ +#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) + int authenticate_console(ssh_session session); int authenticate_kbdint(ssh_session session, const char *password); int verify_knownhost(ssh_session session); diff --git a/examples/sshnetcat.c b/examples/sshnetcat.c index 28fb2765..ccc72c86 100644 --- a/examples/sshnetcat.c +++ b/examples/sshnetcat.c @@ -90,6 +90,7 @@ static void select_loop(ssh_session session,ssh_channel channel){ do{ int fd; + ZERO_STRUCT(fds); FD_ZERO(&fds); if(!eof) FD_SET(0,&fds); |