summaryrefslogtreecommitdiff
path: root/auth-options.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth-options.c')
-rw-r--r--auth-options.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/auth-options.c b/auth-options.c
index 27c0eb05e..b05d6d6f3 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.83 2018/06/19 02:59:41 djm Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.84 2018/10/03 06:38:35 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -469,13 +469,16 @@ sshauthopt_parse(const char *opts, const char **errstrp)
469 errstr = "invalid environment string"; 469 errstr = "invalid environment string";
470 goto fail; 470 goto fail;
471 } 471 }
472 for (cp = opt; cp < tmp; cp++) { 472 if ((cp = strdup(opt)) == NULL)
473 if (!isalnum((u_char)*cp) && *cp != '_') { 473 goto alloc_fail;
474 free(opt); 474 cp[tmp - opt] = '\0'; /* truncate at '=' */
475 errstr = "invalid environment string"; 475 if (!valid_env_name(cp)) {
476 goto fail; 476 free(cp);
477 } 477 free(opt);
478 errstr = "invalid environment string";
479 goto fail;
478 } 480 }
481 free(cp);
479 /* Append it. */ 482 /* Append it. */
480 oarray = ret->env; 483 oarray = ret->env;
481 if ((ret->env = recallocarray(ret->env, ret->nenv, 484 if ((ret->env = recallocarray(ret->env, ret->nenv,