Commit c0690aec authored by Mark Andrews's avatar Mark Andrews
Browse files

Initalise lwres_addr_t.link

    *** CID 316514:  Uninitialized variables  (UNINIT)
    /lib/lwres/lwconfig.c: 320 in lwres_conf_parsenameserver()
    314     		return (LWRES_R_FAILURE); /* Extra junk on line. */
    315
    316     	res = lwres_create_addr(word, &address, 1);
    317     	if (res == LWRES_R_SUCCESS &&
    318     	    ((address.family == LWRES_ADDRTYPE_V4 && ctx->use_ipv4 == 1) ||
    319     	     (address.family == LWRES_ADDRTYPE_V6 && ctx->use_ipv6 == 1))) {
    >>>     CID 316514:  Uninitialized variables  (UNINIT)
    >>>     Using uninitialized value "address". Field "address.link" is uninitialized.
    320     		confdata->nameservers[confdata->nsnext++] = address;
    321     	}
    322
    323     	return (LWRES_R_SUCCESS);
    324     }
    325
parent ad7d5cd4
Pipeline #62216 passed with stages
in 19 minutes and 54 seconds
......@@ -193,6 +193,14 @@ getword(FILE *fp, char *buffer, size_t size) {
return (ch);
}
static void
lwres_initaddr(lwres_addr_t *addr) {
REQUIRE(addr != NULL);
LWRES_LINK_INIT(addr, link);
lwres_resetaddr(addr);
}
static void
lwres_resetaddr(lwres_addr_t *addr) {
REQUIRE(addr != NULL);
......@@ -237,15 +245,17 @@ lwres_conf_init(lwres_context_t *ctx) {
confdata->attempts = 0;
confdata->timeout = 0;
for (i = 0; i < LWRES_CONFMAXNAMESERVERS; i++)
lwres_resetaddr(&confdata->nameservers[i]);
for (i = 0; i < LWRES_CONFMAXNAMESERVERS; i++) {
lwres_initaddr(&confdata->nameservers[i]);
}
for (i = 0; i < LWRES_CONFMAXSEARCH; i++)
for (i = 0; i < LWRES_CONFMAXSEARCH; i++) {
confdata->search[i] = NULL;
}
for (i = 0; i < LWRES_CONFMAXSORTLIST; i++) {
lwres_resetaddr(&confdata->sortlist[i].addr);
lwres_resetaddr(&confdata->sortlist[i].mask);
lwres_initaddr(&confdata->sortlist[i].addr);
lwres_initaddr(&confdata->sortlist[i].mask);
}
}
......@@ -258,8 +268,9 @@ lwres_conf_clear(lwres_context_t *ctx) {
REQUIRE(ctx != NULL);
confdata = &ctx->confdata;
for (i = 0; i < confdata->nsnext; i++)
for (i = 0; i < confdata->nsnext; i++) {
lwres_resetaddr(&confdata->nameservers[i]);
}
if (confdata->domainname != NULL) {
CTXFREE(confdata->domainname,
......@@ -313,6 +324,7 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
if (res != EOF && res != '\n')
return (LWRES_R_FAILURE); /* Extra junk on line. */
lwres_initaddr(&address);
res = lwres_create_addr(word, &address, 1);
if (res == LWRES_R_SUCCESS &&
((address.family == LWRES_ADDRTYPE_V4 && ctx->use_ipv4 == 1) ||
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment