summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2018-03-07 23:53:09 +0000
committerDamien Miller <djm@cvs.openbsd.org>2018-03-07 23:53:09 +0000
commit17d7c20db4a2f19ec687698bdc722f5d69516947 (patch)
treef8be5c065f0ea7567d035959ffa6946cf23ee538 /usr.bin
parentffa7dbda7d361e85047aa35e40c21333d65b7e3a (diff)
revert recent strdelim() change, it causes problems with some configs.
revision 1.124 date: 2018/03/02 03:02:11; author: djm; state: Exp; lines: +19 -8; commitid: nNRsCijZiGG6SUTT; Allow escaped quotes \" and \' in ssh_config and sshd_config quotes option strings. bz#1596 ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/misc.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 42c24d7c1ab..a9bcbf7f719 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.125 2018/03/03 03:15:51 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.126 2018/03/07 23:53:08 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -217,7 +217,7 @@ set_rdomain(int fd, const char *name)
char *
strdelim(char **s)
{
- char *old, *cp;
+ char *old;
int wspace = 0;
if (*s == NULL)
@@ -231,24 +231,13 @@ strdelim(char **s)
if (*s[0] == '\"') {
memmove(*s, *s + 1, strlen(*s)); /* move nul too */
-
/* Find matching quote */
- for (cp = *s; ; cp++) {
- if (*cp == '\0')
- return NULL; /* no matching quote */
- if (*cp == '\\') {
- /* Escape sequence */
- if (cp[1] == '\"' || cp[1] == '\'' ||
- cp[1] == '\\') {
- memmove(cp, cp + 1, strlen(cp));
- continue;
- }
- return NULL; /* invalid escape */
- } else if (*cp == '\"') {
- *(cp++) = '\0';
- *s += strspn(cp, WHITESPACE);
- return old;
- }
+ if ((*s = strpbrk(*s, QUOTE)) == NULL) {
+ return (NULL); /* no matching quote */
+ } else {
+ *s[0] = '\0';
+ *s += strspn(*s + 1, WHITESPACE) + 1;
+ return (old);
}
}