Skip to content

Commit

Permalink
GUACAMOLE-2012: Fix a size calculation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eugen-keeper committed Jan 7, 2025
1 parent 80c900a commit 27dc867
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common-ssh/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ static char *get_method_pref_string(guac_client* client, LIBSSH2_SESSION* sessio
}
if (found || supported_algs_count <= 0) {
bool req_comma = algs_str[0] != 0;
int req_size = strlen(algs_str) + strlen(algs[i]) + (req_comma ? 1 : 0) + 1;
if (req_size > algs_str_size) {
int req_size = strlen(algs[i]) + (req_comma ? 1 : 0) + 1;
if (strlen(algs_str) + req_size > algs_str_size) {
algs_str_size += MAX(req_size, 1024);
algs_str = guac_mem_realloc(algs_str, algs_str_size);
}
Expand All @@ -467,8 +467,8 @@ static char *get_method_pref_string(guac_client* client, LIBSSH2_SESSION* sessio
}
strcat(algs_str, algs[i]);
} else {
guac_client_log(client, GUAC_LOG_WARNING,
"Preferred algorithm/cipher '%s' is not supported by libssh2", algs[i]);
guac_client_log(client, GUAC_LOG_WARNING,
"Preferred algorithm/cipher '%s' is not supported by libssh2", algs[i]);
}
i++;
}
Expand Down

0 comments on commit 27dc867

Please sign in to comment.