aboutsummaryrefslogtreecommitdiff
path: root/src/bind.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-11-01 14:59:27 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-11-18 11:59:01 +0100
commitc8a621c6063f205e631d83a8ccd4befc60056e93 (patch)
treea22b2067f408fb2b8d9dadfd0bb3b4d84dc785f6 /src/bind.c
parentec67ad47ebe200ad8a6b508e8ca061a073a3fde1 (diff)
downloadlibssh-c8a621c6063f205e631d83a8ccd4befc60056e93.tar.gz
libssh-c8a621c6063f205e631d83a8ccd4befc60056e93.tar.xz
libssh-c8a621c6063f205e631d83a8ccd4befc60056e93.zip
Use only one variable denoting the size of methods arrays
Previously, there was non-consistent usage of constans SSH_KEX_METHODS, KEX_METHODS_SIZE and of magic number 10 to reference the arrays used for algorithm negotiation by peers. This commit settles down to the single constant and its usage throughout the whole codebase. Fixes T195 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/bind.c')
-rw-r--r--src/bind.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bind.c b/src/bind.c
index 8b45ef8b..fa8df9ea 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -411,7 +411,7 @@ void ssh_bind_free(ssh_bind sshbind){
ssh_key_free(sshbind->ed25519);
sshbind->ed25519 = NULL;
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < SSH_KEX_METHODS; i++) {
if (sshbind->wanted_methods[i]) {
SAFE_FREE(sshbind->wanted_methods[i]);
}
@@ -442,7 +442,7 @@ int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){
session->server = 1;
/* Copy options from bind to session */
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < SSH_KEX_METHODS; i++) {
if (sshbind->wanted_methods[i]) {
session->opts.wanted_methods[i] = strdup(sshbind->wanted_methods[i]);
if (session->opts.wanted_methods[i] == NULL) {