Skip to content

Commit 1e26aac

Browse files
committed
'%' at the end of a string is itself, and not an error
1 parent 11a542a commit 1e26aac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/xlat.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,12 +1509,14 @@ static ssize_t xlat_tokenize_literal(TALLOC_CTX *ctx, char *fmt, xlat_exp_t **he
15091509

15101510
/*
15111511
* Check for valid single-character expansions.
1512+
*
1513+
* Allow '%' at the end of a string as itself.
15121514
*/
1513-
if (p[0] == '%') {
1515+
if ((p[0] == '%') && p[1]) {
15141516
ssize_t slen;
15151517
xlat_exp_t *next;
15161518

1517-
if (!p[1] || !strchr("%}cdelmntCDGHIMSTYv", p[1])) {
1519+
if (!strchr("%}cdelmntCDGHIMSTYv", p[1])) {
15181520
talloc_free(node);
15191521
*error = "Invalid variable expansion";
15201522
p++;

0 commit comments

Comments
 (0)