mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
misc: Fix OpenSSH banner parsing
Signed-off-by: Lucas Mulling <lucas.mulling@suse.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Norbert Pocs <norbertpocs0@gmail.com>
(cherry picked from commit d758990d39)
This commit is contained in:
committed by
Jakub Jelen
parent
573e0e48dc
commit
66314eeb71
@@ -1397,6 +1397,7 @@ int ssh_analyze_banner(ssh_session session, int server)
|
||||
char *tmp = NULL;
|
||||
unsigned long int major = 0UL;
|
||||
unsigned long int minor = 0UL;
|
||||
int off = 0;
|
||||
|
||||
/*
|
||||
* The banner is typical:
|
||||
@@ -1416,8 +1417,9 @@ int ssh_analyze_banner(ssh_session session, int server)
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
minor = strtoul(openssh + 10, &tmp, 10);
|
||||
if ((tmp == (openssh + 10)) ||
|
||||
off = major >= 10 ? 11 : 10;
|
||||
minor = strtoul(openssh + off, &tmp, 10);
|
||||
if ((tmp == (openssh + off)) ||
|
||||
((errno == ERANGE) && (major == ULONG_MAX)) ||
|
||||
((errno != 0) && (major == 0)) ||
|
||||
(minor > 100)) {
|
||||
|
||||
Reference in New Issue
Block a user