diff options
Diffstat (limited to 'expr.c')
-rw-r--r-- | expr.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -762,13 +762,20 @@ ExprResolveString(ExprDef * expr, if (ExprResolveString(left, &leftRtrn, lookup, lookupPriv) && ExprResolveString(right, &rightRtrn, lookup, lookupPriv)) { - int len; char *new; - len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1; + +#ifdef HAVE_ASPRINTF + if (asprintf(&new, "%s%s", leftRtrn.str, rightRtrn.str) < 0) + new = NULL; +#else + size_t len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1; new = malloc(len); +#endif if (new) { +#ifndef HAVE_ASPRINTF snprintf(new, len, "%s%s", leftRtrn.str, rightRtrn.str); +#endif val_rtrn->str = new; return True; } |