misc: Fix format truncation in ssh_path_expand_escape()
error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Этот коммит содержится в:
родитель
8164e1ff9c
Коммит
20406e51c9
@ -223,7 +223,7 @@ struct ssh_session_struct {
|
|||||||
char *agent_socket;
|
char *agent_socket;
|
||||||
unsigned long timeout; /* seconds */
|
unsigned long timeout; /* seconds */
|
||||||
unsigned long timeout_usec;
|
unsigned long timeout_usec;
|
||||||
unsigned int port;
|
uint16_t port;
|
||||||
socket_t fd;
|
socket_t fd;
|
||||||
int StrictHostKeyChecking;
|
int StrictHostKeyChecking;
|
||||||
char compressionlevel;
|
char compressionlevel;
|
||||||
|
13
src/misc.c
13
src/misc.c
@ -1237,14 +1237,13 @@ char *ssh_path_expand_escape(ssh_session session, const char *s)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (session->opts.port < 65536) {
|
if (session->opts.port > 0) {
|
||||||
char tmp[6];
|
char tmp[6];
|
||||||
|
|
||||||
snprintf(tmp,
|
snprintf(tmp, sizeof(tmp), "%hu",
|
||||||
sizeof(tmp),
|
(uint16_t)(session->opts.port > 0 ? session->opts.port
|
||||||
"%u",
|
: 22));
|
||||||
session->opts.port > 0 ? session->opts.port : 22);
|
x = strdup(tmp);
|
||||||
x = strdup(tmp);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user