From 21703c652eac43bbb2ebbed15c9e0c456ce6ebee Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 31 Dec 2006 10:05:20 +0000 Subject: 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 --- nslcd-common.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'nslcd-common.h') 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) \ -- cgit v1.2.3