summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
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