Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd-common.h
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2006-12-31 11:05:20 +0100
committerArthur de Jong <arthur@arthurdejong.org>2006-12-31 11:05:20 +0100
commit21703c652eac43bbb2ebbed15c9e0c456ce6ebee (patch)
treebf51cf6cc98c22134dc311658a68ee1312a705fa /nslcd-common.h
parentb013f9976e2d620094d3d4584ee8243df2b9c87f (diff)
if the string to write is NULL, write an empty string
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@210 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd-common.h')
-rw-r--r--nslcd-common.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/nslcd-common.h b/nslcd-common.h
index a283fb4..88ed40d 100644
--- a/nslcd-common.h
+++ b/nslcd-common.h
@@ -81,9 +81,16 @@ static void debug_dump(const void *ptr,size_t size)
#define WRITE_STRING(fp,str) \
DEBUG_PRINT("WRITE_STRING: var="__STRING(str)" string=\"%s\"",str); \
- WRITE_INT32(fp,strlen(str)); \
- if (tmpint32>0) \
- { WRITE(fp,str,tmpint32); }
+ if (str==NULL) \
+ { \
+ WRITE_INT32(fp,0); \
+ } \
+ else \
+ { \
+ WRITE_INT32(fp,strlen(str)); \
+ if (tmpint32>0) \
+ { WRITE(fp,str,tmpint32); } \
+ }
#define WRITE_FLUSH(fp) \
if (fflush(fp)<0) \