|
Lines 320-326
_ssh_read_banner(struct ssh *ssh, struct sshbuf *banner)
Link Here
|
| 320 |
const char *mismatch = "Protocol mismatch.\r\n"; |
320 |
const char *mismatch = "Protocol mismatch.\r\n"; |
| 321 |
const u_char *s = sshbuf_ptr(input); |
321 |
const u_char *s = sshbuf_ptr(input); |
| 322 |
u_char c; |
322 |
u_char c; |
| 323 |
char *cp, *remote_version; |
323 |
char *cp = NULL, *remote_version = NULL; |
| 324 |
int r, remote_major, remote_minor, expect_nl; |
324 |
int r, remote_major, remote_minor, expect_nl; |
| 325 |
size_t n, j; |
325 |
size_t n, j; |
| 326 |
|
326 |
|
|
Lines 363-381
_ssh_read_banner(struct ssh *ssh, struct sshbuf *banner)
Link Here
|
| 363 |
if ((r = sshbuf_consume(input, j)) != 0) |
363 |
if ((r = sshbuf_consume(input, j)) != 0) |
| 364 |
return r; |
364 |
return r; |
| 365 |
|
365 |
|
| 366 |
if ((cp = sshbuf_dup_string(banner)) == NULL) |
366 |
if ((cp = sshbuf_dup_string(banner)) == NULL) { |
| 367 |
return SSH_ERR_ALLOC_FAIL; |
367 |
r = SSH_ERR_ALLOC_FAIL; |
|
|
368 |
goto out; |
| 369 |
} |
| 368 |
/* XXX remote version must be the same size as banner for sscanf */ |
370 |
/* XXX remote version must be the same size as banner for sscanf */ |
| 369 |
if ((remote_version = calloc(1, sshbuf_len(banner))) == NULL) |
371 |
if ((remote_version = calloc(1, sshbuf_len(banner))) == NULL) { |
| 370 |
return SSH_ERR_ALLOC_FAIL; |
372 |
r = SSH_ERR_ALLOC_FAIL; |
|
|
373 |
goto out; |
| 374 |
} |
| 371 |
|
375 |
|
| 372 |
/* |
376 |
/* |
| 373 |
* Check that the versions match. In future this might accept |
377 |
* Check that the versions match. In future this might accept |
| 374 |
* several versions and set appropriate flags to handle them. |
378 |
* several versions and set appropriate flags to handle them. |
| 375 |
*/ |
379 |
*/ |
| 376 |
if (sscanf(cp, "SSH-%d.%d-%[^\n]\n", |
380 |
if (sscanf(cp, "SSH-%d.%d-%[^\n]\n", |
| 377 |
&remote_major, &remote_minor, remote_version) != 3) |
381 |
&remote_major, &remote_minor, remote_version) != 3) { |
| 378 |
return SSH_ERR_INVALID_FORMAT; |
382 |
r = SSH_ERR_INVALID_FORMAT; |
|
|
383 |
goto out; |
| 384 |
} |
| 379 |
debug("Remote protocol version %d.%d, remote software version %.100s", |
385 |
debug("Remote protocol version %d.%d, remote software version %.100s", |
| 380 |
remote_major, remote_minor, remote_version); |
386 |
remote_major, remote_minor, remote_version); |
| 381 |
|
387 |
|
|
Lines 384-394
_ssh_read_banner(struct ssh *ssh, struct sshbuf *banner)
Link Here
|
| 384 |
remote_major = 2; |
390 |
remote_major = 2; |
| 385 |
remote_minor = 0; |
391 |
remote_minor = 0; |
| 386 |
} |
392 |
} |
| 387 |
if (remote_major != 2) |
393 |
if (remote_major != 2) { |
| 388 |
return SSH_ERR_PROTOCOL_MISMATCH; |
394 |
r = SSH_ERR_PROTOCOL_MISMATCH; |
|
|
395 |
goto out; |
| 396 |
} |
| 389 |
debug("Remote version string %.100s", cp); |
397 |
debug("Remote version string %.100s", cp); |
|
|
398 |
|
| 399 |
out: |
| 400 |
free(remote_version); |
| 390 |
free(cp); |
401 |
free(cp); |
| 391 |
return 0; |
402 |
return r; |
| 392 |
} |
403 |
} |
| 393 |
|
404 |
|
| 394 |
/* Send our own protocol version identification. */ |
405 |
/* Send our own protocol version identification. */ |
| 395 |
- |
|
|
| 396 |
64. openssh-8.0p1/ssh-keygen.c:2291: leaked_storage: Variable "blob" going out of scope leaks the storage it points to. |
406 |
64. openssh-8.0p1/ssh-keygen.c:2291: leaked_storage: Variable "blob" going out of scope leaks the storage it points to. |
| 397 |
-- |
|
|
| 398 |
ssh-keygen.c | 3 +++ |
407 |
ssh-keygen.c | 3 +++ |
| 399 |
1 file changed, 3 insertions(+) |
408 |
1 file changed, 3 insertions(+) |