From 6449fc3b22284cea0aa186b0c6468696a1d8c1b4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 16 Sep 1997 17:40:17 +0000 Subject: Fixing assumtions that malloced memory is zero filled - making sure it is. Jeremy (jallison@whistle.com) (This used to be commit 59ee0d0c7ea166a3bf58ceb4c939217d6ff74498) --- source3/namedbname.c | 2 ++ source3/namedbresp.c | 2 ++ source3/namedbwork.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/namedbname.c b/source3/namedbname.c index c91541cc81..a45a749f14 100644 --- a/source3/namedbname.c +++ b/source3/namedbname.c @@ -486,6 +486,8 @@ struct name_record *add_netbios_entry(struct subnet_record *d, return NULL; } + bzero((char *)n->ip_flgs, sizeof(*n->ip_flgs) * n->num_ips); + make_nmb_name(&n->name,name,type,scope); if ((n2 = find_name_search(&found_subnet, &n->name, search, new_only?ipzero:ip))) diff --git a/source3/namedbresp.c b/source3/namedbresp.c index 98f8ca774b..86d7eddbd4 100644 --- a/source3/namedbresp.c +++ b/source3/namedbresp.c @@ -104,6 +104,8 @@ struct response_record *make_response_queue_record(enum state_type state, if (!(n = (struct response_record *)malloc(sizeof(*n)))) return(NULL); + bzero((char *)n, sizeof(*n)); + n->response_id = id; n->state = state; n->fd = fd; diff --git a/source3/namedbwork.c b/source3/namedbwork.c index 2982ffd3e7..a6260aab46 100644 --- a/source3/namedbwork.c +++ b/source3/namedbwork.c @@ -84,7 +84,8 @@ static struct work_record *make_workgroup(char *name) work = (struct work_record *)malloc(sizeof(*work)); if (!work) return(NULL); - + bzero((char *)work, sizeof(*work)); + StrnCpy(work->work_group,name,sizeof(work->work_group)-1); work->serverlist = NULL; @@ -92,6 +93,7 @@ static struct work_record *make_workgroup(char *name) SV_TYPE_POTENTIAL_BROWSER : 0 ); work->RunningElection = False; work->ElectionCount = 0; + work->announce_interval = 0; work->needelection = False; work->needannounce = True; work->mst_state = MST_POTENTIAL; -- cgit