summaryrefslogtreecommitdiff
path: root/evar.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2025-05-19 05:51:42 +0000
committerXin LI <delphij@FreeBSD.org>2025-05-19 05:51:42 +0000
commit48b0a08b8724e7d5671dac2abf17ddb6d4e2a8f8 (patch)
tree1b948df937500aa7672f42e2eb1b2a6d743aa51f /evar.c
parent8c9fd1007159a1cfe994ccf7021688a679a0a39c (diff)
Diffstat (limited to 'evar.c')
-rw-r--r--evar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/evar.c b/evar.c
index adda16d297a1..d54333954a84 100644
--- a/evar.c
+++ b/evar.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2024 Mark Nudelman
+ * Copyright (C) 1984-2025 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -28,7 +28,7 @@ static size_t skipsl(constant char *buf, size_t len, size_t e)
lbool esc = FALSE;
while (e < len && buf[e] != '\0' && (esc || (buf[e] != '/' && buf[e] != '}')))
{
- esc = (!esc && buf[e] == '\\');
+ esc = (!esc && buf[e] == '\\' && buf[e+1] != '\0');
++e;
}
return e;
@@ -150,7 +150,7 @@ static size_t add_evar(struct xbuffer *xbuf, mutable char *buf, size_t len, size
size_t r;
for (r = 0; repl[r] != '\0'; r++)
{
- if (repl[r] == '\\') ++r;
+ if (repl[r] == '\\' && repl[r+1] != '\0') ++r;
xbuf_add_char(xbuf, repl[r]);
}
}