diff options
author | markus@openbsd.org <markus@openbsd.org> | 2017-05-31 10:54:00 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-06-01 14:55:23 +1000 |
commit | 75b8af8de805c0694b37fcf80ce82783b2acc86f (patch) | |
tree | d93d2b497f3eba328181548e20365f8c649ecfac /auth2-pubkey.c | |
parent | 84008608c9ee944d9f72f5100f31ccff743b10f2 (diff) |
upstream commit
make sure we don't pass a NULL string to vfprintf
(triggered by the principals-command regress test); ok bluhm
Upstream-ID: eb49854f274ab37a0b57056a6af379a0b7111990
Diffstat (limited to 'auth2-pubkey.c')
-rw-r--r-- | auth2-pubkey.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/auth2-pubkey.c b/auth2-pubkey.c index 271dbaf65..5794f1f4d 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-pubkey.c,v 1.66 2017/05/31 09:15:42 deraadt Exp $ */ | 1 | /* $OpenBSD: auth2-pubkey.c,v 1.67 2017/05/31 10:54:00 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -587,7 +587,7 @@ match_principals_option(const char *principal_list, struct sshkey_cert *cert) | |||
587 | } | 587 | } |
588 | 588 | ||
589 | static int | 589 | static int |
590 | process_principals(FILE *f, char *file, struct passwd *pw, | 590 | process_principals(FILE *f, const char *file, struct passwd *pw, |
591 | const struct sshkey_cert *cert) | 591 | const struct sshkey_cert *cert) |
592 | { | 592 | { |
593 | char line[SSH_MAX_PUBKEY_BYTES], *cp, *ep, *line_opts; | 593 | char line[SSH_MAX_PUBKEY_BYTES], *cp, *ep, *line_opts; |
@@ -625,8 +625,7 @@ process_principals(FILE *f, char *file, struct passwd *pw, | |||
625 | for (i = 0; i < cert->nprincipals; i++) { | 625 | for (i = 0; i < cert->nprincipals; i++) { |
626 | if (strcmp(cp, cert->principals[i]) == 0) { | 626 | if (strcmp(cp, cert->principals[i]) == 0) { |
627 | debug3("%s:%lu: matched principal \"%.100s\"", | 627 | debug3("%s:%lu: matched principal \"%.100s\"", |
628 | file == NULL ? "(command)" : file, | 628 | file, linenum, cert->principals[i]); |
629 | linenum, cert->principals[i]); | ||
630 | if (auth_parse_options(pw, line_opts, | 629 | if (auth_parse_options(pw, line_opts, |
631 | file, linenum) != 1) | 630 | file, linenum) != 1) |
632 | continue; | 631 | continue; |
@@ -757,7 +756,7 @@ match_principals_command(struct passwd *user_pw, const struct sshkey *key) | |||
757 | uid_swapped = 1; | 756 | uid_swapped = 1; |
758 | temporarily_use_uid(pw); | 757 | temporarily_use_uid(pw); |
759 | 758 | ||
760 | ok = process_principals(f, NULL, pw, cert); | 759 | ok = process_principals(f, "(command)", pw, cert); |
761 | 760 | ||
762 | fclose(f); | 761 | fclose(f); |
763 | f = NULL; | 762 | f = NULL; |