summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2015-12-04 21:51:06 +0000
committertobias <tobias@openbsd.org>2015-12-04 21:51:06 +0000
commit536aa30664b1de66eae43af845db1af652f48173 (patch)
treea6cde32e5e803350d740f6dbcb65ed251ffd6da5
parentDocument that the -M option doesn't save a backup when passed ''. Also (diff)
downloadwireguard-openbsd-536aa30664b1de66eae43af845db1af652f48173.tar.xz
wireguard-openbsd-536aa30664b1de66eae43af845db1af652f48173.zip
Properly handle invalid %-format by calling fatal.
ok deraadt, djm
-rw-r--r--usr.bin/ssh/misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 429c4515cad..af90560a9bd 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.99 2015/10/24 08:34:09 sthen Exp $ */
+/* $OpenBSD: misc.c,v 1.100 2015/12/04 21:51:06 tobias Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -587,6 +587,8 @@ percent_expand(const char *string, ...)
/* %% case */
if (*string == '%')
goto append;
+ if (*string == '\0')
+ fatal("%s: invalid format", __func__);
for (j = 0; j < num_keys; j++) {
if (strchr(keys[j].key, *string) != NULL) {
i = strlcat(buf, keys[j].repl, sizeof(buf));