summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-06-05 09:14:12 +0000
committerArthur de Jong <arthur@arthurdejong.org>2011-06-05 09:14:12 +0000
commit8d25c3f2a4bca981e23138c1b960b4da99e1d788 (patch)
tree2e3b88ef782fbf7936cfb32dd125c4f1e49933cd /common
parentceb7626c048fd72d0c3d9c663dd7c7f2d66338d0 (diff)
handle expressions where the expander function returns NULL (handle it as an empty string)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1471 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'common')
-rw-r--r--common/expr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/expr.c b/common/expr.c
index fc694cc..7fa4f84 100644
--- a/common/expr.c
+++ b/common/expr.c
@@ -93,6 +93,8 @@ MUST_USE static const char *parse_dollar_expression(
if (parse_name(str,ptr,varname,sizeof(varname))==NULL)
return NULL;
varvalue=expander(varname,expander_arg);
+ if (varvalue==NULL)
+ varvalue="";
if (str[*ptr]=='}')
{
/* simple substitute */
@@ -148,6 +150,8 @@ MUST_USE static const char *parse_dollar_expression(
if (parse_name(str,ptr,varname,sizeof(varname))==NULL)
return NULL;
varvalue=expander(varname,expander_arg);
+ if (varvalue==NULL)
+ varvalue="";
if (strlen(varvalue)>=buflen)
return NULL;
strcpy(buffer,varvalue);