diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-28 10:47:17 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-28 10:47:17 +0100 |
commit | 0fb00e2586c84da109cbdd583285a23b76342180 (patch) | |
tree | f77b32c70f2c37c3182c62f1dea44e50e7805534 /common | |
parent | 4202f9b34eead0aac525708192026785959cf07d (diff) |
WRITE_STRINGLIST(): properly handle the case where the list is null (result of change in r1028)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1037 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'common')
-rw-r--r-- | common/nslcd-prot.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/common/nslcd-prot.h b/common/nslcd-prot.h index ce61106..abfb4cb 100644 --- a/common/nslcd-prot.h +++ b/common/nslcd-prot.h @@ -108,16 +108,24 @@ static void debug_dump(const void *ptr,size_t size) } #define WRITE_STRINGLIST(fp,arr) \ - /* first determin length of array */ \ - for (tmp3int32=0;(arr)[tmp3int32]!=NULL;tmp3int32++) \ - /*noting*/ ; \ - /* write number of strings */ \ - DEBUG_PRINT("WRITE_STRLST: var="__STRING(arr)" num=%d",(int)tmp3int32); \ - WRITE_TYPE(fp,tmp3int32,int32_t); \ - /* write strings */ \ - for (tmp2int32=0;tmp2int32<tmp3int32;tmp2int32++) \ + if ((arr)==NULL) \ + { \ + DEBUG_PRINT("WRITE_STRLST: var="__STRING(arr)" num=%d",0); \ + WRITE_INT32(fp,0); \ + } \ + else \ { \ - WRITE_STRING(fp,(arr)[tmp2int32]); \ + /* first determin length of array */ \ + for (tmp3int32=0;(arr)[tmp3int32]!=NULL;tmp3int32++) \ + /*noting*/ ; \ + /* write number of strings */ \ + DEBUG_PRINT("WRITE_STRLST: var="__STRING(arr)" num=%d",(int)tmp3int32); \ + WRITE_TYPE(fp,tmp3int32,int32_t); \ + /* write strings */ \ + for (tmp2int32=0;tmp2int32<tmp3int32;tmp2int32++) \ + { \ + WRITE_STRING(fp,(arr)[tmp2int32]); \ + } \ } #define WRITE_STRINGLIST_EXCEPT(fp,arr,not) \ |