X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsrc%2Fstring.c;h=fbb19537cba40fcf6d0302f82a66a9a6c0619253;hb=48e32fe6695541cccec39bb48cebf023f447e462;hp=4726fbe4e30e0de5b7fa5256dd4c10a6199d1dbd;hpb=53cc1417d804b27674f9e18fec09dee3badd080b;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/string.c b/src/src/string.c index 4726fbe4e..fbb19537c 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -575,7 +575,7 @@ uschar * string_copy_dnsdomain(uschar *s) { uschar *yield; -uschar *ss = yield = store_get(Ustrlen(s) + 1, is_tainted(s)); +uschar *ss = yield = store_get(Ustrlen(s) + 1, TRUE); /* always treat as tainted */ while (*s != 0) { @@ -952,12 +952,15 @@ else s = ss; if (!*s || *++s != sep || sep_is_special) break; } + + /* Trim trailing spaces from the returned string */ + /* while (g->ptr > 0 && isspace(g->s[g->ptr-1])) g->ptr--; */ while ( g->ptr > 0 && isspace(g->s[g->ptr-1]) && (g->ptr == 1 || g->s[g->ptr-2] != '\\') ) g->ptr--; buffer = string_from_gstring(g); - gstring_release_unused(g); + gstring_release_unused_trc(g, func, line); } /* Update the current pointer and return the new string */ @@ -1143,7 +1146,7 @@ BOOL srctaint = is_tainted(s); if (!g) { unsigned inc = count < 4096 ? 127 : 1023; - unsigned size = ((count + inc) & ~inc) + 1; + unsigned size = ((count + inc) & ~inc) + 1; /* round up requested count */ g = string_get_tainted(size, srctaint); } else if (srctaint && !is_tainted(g->s)) @@ -1692,6 +1695,7 @@ int main(void) uschar buffer[256]; printf("Testing is_ip_address\n"); +store_init(); while (fgets(CS buffer, sizeof(buffer), stdin) != NULL) {