summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-03-07 23:53:08 +0000
committerDamien Miller <djm@mindrot.org>2018-03-12 11:48:15 +1100
commitc7c458e8261b04d161763cd333d74e7a5842e917 (patch)
treed22687d9553df604f3ef5c0087a396f6d1309a77 /misc.c
parent0bcd871ccdf3baf2b642509ba4773d5be067cfa2 (diff)
upstream: 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@ OpenBSD-Commit-ID: 59c40b1b81206d713c06b49d8477402c86babda5
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/misc.c b/misc.c
index 1e660b021..fbc363100 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.125 2018/03/03 03:15:51 djm Exp $ */ 1/* $OpenBSD: misc.c,v 1.126 2018/03/07 23:53:08 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -242,7 +242,7 @@ set_rdomain(int fd, const char *name)
242char * 242char *
243strdelim(char **s) 243strdelim(char **s)
244{ 244{
245 char *old, *cp; 245 char *old;
246 int wspace = 0; 246 int wspace = 0;
247 247
248 if (*s == NULL) 248 if (*s == NULL)
@@ -256,24 +256,13 @@ strdelim(char **s)
256 256
257 if (*s[0] == '\"') { 257 if (*s[0] == '\"') {
258 memmove(*s, *s + 1, strlen(*s)); /* move nul too */ 258 memmove(*s, *s + 1, strlen(*s)); /* move nul too */
259
260 /* Find matching quote */ 259 /* Find matching quote */
261 for (cp = *s; ; cp++) { 260 if ((*s = strpbrk(*s, QUOTE)) == NULL) {
262 if (*cp == '\0') 261 return (NULL); /* no matching quote */
263 return NULL; /* no matching quote */ 262 } else {
264 if (*cp == '\\') { 263 *s[0] = '\0';
265 /* Escape sequence */ 264 *s += strspn(*s + 1, WHITESPACE) + 1;
266 if (cp[1] == '\"' || cp[1] == '\'' || 265 return (old);
267 cp[1] == '\\') {
268 memmove(cp, cp + 1, strlen(cp));
269 continue;
270 }
271 return NULL; /* invalid escape */
272 } else if (*cp == '\"') {
273 *(cp++) = '\0';
274 *s += strspn(cp, WHITESPACE);
275 return old;
276 }
277 } 266 }
278 } 267 }
279 268