From: Alan T. DeKok Date: Wed, 9 Sep 2015 17:40:31 +0000 (-0400) Subject: Count backslash - CHAR in node->len X-Git-Tag: release_3_0_10~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35d2b3d2d2e7324a3964ef0f999d0c4f5837fd33;p=thirdparty%2Ffreeradius-server.git Count backslash - CHAR in node->len --- diff --git a/src/main/xlat.c b/src/main/xlat.c index c077e3d139a..0f66897d182 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -1400,7 +1400,9 @@ static ssize_t xlat_tokenize_literal(TALLOC_CTX *ctx, char *fmt, xlat_exp_t **he *error = "Invalid escape at end of string"; return -(p - fmt); } + p += 2; + node->len += 2; continue; } @@ -2469,6 +2471,7 @@ static ssize_t xlat_expand_struct(char **out, size_t outlen, REQUEST *request, x } len = strlen(buff); + /* * If out doesn't point to an existing buffer * copy the pointer to our buffer over. diff --git a/src/tests/unit/xlat.txt b/src/tests/unit/xlat.txt index 8306b9b46c6..8b0bf5eb2f5 100644 --- a/src/tests/unit/xlat.txt +++ b/src/tests/unit/xlat.txt @@ -128,3 +128,10 @@ data /([A-Z0-9\-]*)_%{Calling-Station-Id}/ xlat %{length:1 + 2 data ERROR offset 14 'Missing closing brace at end of string' + +xlat "%t\tfoo" +data "%t\tfoo" + +xlat "%t\t%{Client-IP-Address}" +data "%t\t%{Client-IP-Address}" +