upstream: prepare readconf.c for fuzzing; remove fatal calls and

fix some (one-off) memory leaks; ok markus@

OpenBSD-Commit-ID: 91c6aec57b0e7aae9190de188e9fe8933aad5ec5
This commit is contained in:
djm@openbsd.org 2020-12-17 23:10:27 +00:00 committed by Damien Miller
parent bef92346c4
commit 43026da035
4 changed files with 412 additions and 161 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $OpenBSD: readconf.h,v 1.135 2020/10/16 13:26:13 djm Exp $ */ /* $OpenBSD: readconf.h,v 1.136 2020/12/17 23:10:27 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -205,8 +205,9 @@ const char *kex_default_pk_alg(void);
char *ssh_connection_hash(const char *thishost, const char *host, char *ssh_connection_hash(const char *thishost, const char *host,
const char *portstr, const char *user); const char *portstr, const char *user);
void initialize_options(Options *); void initialize_options(Options *);
void fill_default_options(Options *); int fill_default_options(Options *);
void fill_default_options_for_canonicalization(Options *); void fill_default_options_for_canonicalization(Options *);
void free_options(Options *o);
int process_config_line(Options *, struct passwd *, const char *, int process_config_line(Options *, struct passwd *, const char *,
const char *, char *, const char *, int, int *, int); const char *, char *, const char *, int, int *, int);
int read_config_file(const char *, struct passwd *, const char *, int read_config_file(const char *, struct passwd *, const char *,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-keysign.c,v 1.65 2020/10/18 11:32:02 djm Exp $ */ /* $OpenBSD: ssh-keysign.c,v 1.66 2020/12/17 23:10:27 djm Exp $ */
/* /*
* Copyright (c) 2002 Markus Friedl. All rights reserved. * Copyright (c) 2002 Markus Friedl. All rights reserved.
* *
@ -207,7 +207,7 @@ main(int argc, char **argv)
initialize_options(&options); initialize_options(&options);
(void)read_config_file(_PATH_HOST_CONFIG_FILE, pw, "", "", (void)read_config_file(_PATH_HOST_CONFIG_FILE, pw, "", "",
&options, 0, NULL); &options, 0, NULL);
fill_default_options(&options); (void)fill_default_options(&options);
if (options.enable_ssh_keysign != 1) if (options.enable_ssh_keysign != 1)
fatal("ssh-keysign not enabled in %s", fatal("ssh-keysign not enabled in %s",
_PATH_HOST_CONFIG_FILE); _PATH_HOST_CONFIG_FILE);

5
ssh.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh.c,v 1.542 2020/11/12 22:38:57 dtucker Exp $ */ /* $OpenBSD: ssh.c,v 1.543 2020/12/17 23:10:27 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -1237,7 +1237,8 @@ main(int ac, char **av)
} }
/* Fill configuration defaults. */ /* Fill configuration defaults. */
fill_default_options(&options); if (fill_default_options(&options) != 0)
cleanup_exit(255);
if (options.user == NULL) if (options.user == NULL)
options.user = xstrdup(pw->pw_name); options.user = xstrdup(pw->pw_name);