From 6bca45020764ac36eee77518bc3727aaf5ebc268 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 23 Aug 2002 15:01:08 +0000 Subject: Cope with negative cache dns entries better. (This used to be commit 3404023260a5d6fed5523eb378d4a1ad418302a0) --- source3/libsmb/namecache.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c index d985832613..31341df86e 100644 --- a/source3/libsmb/namecache.c +++ b/source3/libsmb/namecache.c @@ -91,19 +91,20 @@ static TDB_DATA namecache_value(struct in_addr *ip_list, int num_names, { TDB_DATA retval; struct nc_value *value; - int size; - - size = sizeof(struct nc_value); + int size = sizeof(struct nc_value); if (num_names > 0) size += sizeof(struct in_addr) * (num_names-1); value = (struct nc_value *)malloc(size); - + + memset(value, 0, size); + value->expiry = expiry; value->count = num_names; - memcpy(value->ip_list, ip_list, sizeof(*ip_list)); + if (ip_list) + memcpy(value->ip_list, ip_list, sizeof(*ip_list)); retval.dptr = (char *)value; retval.dsize = size; -- cgit