summaryrefslogtreecommitdiffstats
path: root/source/libsmb/namecache.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-08-23 13:23:49 +0000
committerTim Potter <tpot@samba.org>2002-08-23 13:23:49 +0000
commite13016bb42dbba675d6e7ee7e163543aad2e62c2 (patch)
treebe568345d5a2f95d635c5711e0acc2c1489597b5 /source/libsmb/namecache.c
parent34a7efd1f8fc5d5fda7cafe50cb6fd7c4aac32ab (diff)
downloadsamba-e13016bb42dbba675d6e7ee7e163543aad2e62c2.tar.gz
samba-e13016bb42dbba675d6e7ee7e163543aad2e62c2.tar.xz
samba-e13016bb42dbba675d6e7ee7e163543aad2e62c2.zip
Don't take the sizeof(struct in_addr) * -1
Diffstat (limited to 'source/libsmb/namecache.c')
-rw-r--r--source/libsmb/namecache.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/libsmb/namecache.c b/source/libsmb/namecache.c
index f05f76a22be..d985832613f 100644
--- a/source/libsmb/namecache.c
+++ b/source/libsmb/namecache.c
@@ -93,8 +93,10 @@ static TDB_DATA namecache_value(struct in_addr *ip_list, int num_names,
struct nc_value *value;
int size;
- size = sizeof(struct nc_value) + sizeof(struct in_addr) *
- (num_names-1);
+ size = sizeof(struct nc_value);
+
+ if (num_names > 0)
+ size += sizeof(struct in_addr) * (num_names-1);
value = (struct nc_value *)malloc(size);