summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-08-23 15:01:08 +0000
committerTim Potter <tpot@samba.org>2002-08-23 15:01:08 +0000
commit3404023260a5d6fed5523eb378d4a1ad418302a0 (patch)
tree2cb1fccb29d5182a540257725b2c6af4ab68f796 /source
parentf76e5b2677beb161c2f9c0d3dd78e707655e942f (diff)
downloadsamba-3404023260a5d6fed5523eb378d4a1ad418302a0.tar.gz
samba-3404023260a5d6fed5523eb378d4a1ad418302a0.tar.xz
samba-3404023260a5d6fed5523eb378d4a1ad418302a0.zip
Cope with negative cache dns entries better.
Diffstat (limited to 'source')
-rw-r--r--source/libsmb/namecache.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/libsmb/namecache.c b/source/libsmb/namecache.c
index d985832613f..31341df86ed 100644
--- a/source/libsmb/namecache.c
+++ b/source/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;