From 7993d9b77ff870b585e16dbfa557be7f896c564f Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Feb 2013 05:06:44 +0000 Subject: fix unitialized memory screwing up dialog input (pok, mdv, mga#8729) --- mdk-stage1/NEWS | 1 + mdk-stage1/network.c | 6 +++--- mdk-stage1/newt-frontend.c | 2 +- mdk-stage1/stdio-frontend.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index 46ea493c0..09149f17f 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,4 @@ +- fix unitialized memory screwing up dialog input (pok, mdv, mga#8729) - kill bootsplash support (we drop bootsplash in kernel in 2008) - kill firmware loader now that firmware are loaded by the kernel diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 9030fbbde..29455e5bc 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -538,7 +538,7 @@ static enum return_type configure_network(struct interface_info * intf) char * boulet; if (dhcp_hostname || dhcp_domain) { - answers = (char **) malloc(sizeof(questions)); + answers = (char **) calloc(1, sizeof(questions)); answers[0] = strdup(dhcp_hostname); answers[1] = strdup(dhcp_domain); } @@ -1006,7 +1006,7 @@ enum return_type ftp_prepare(void) if (!IS_AUTOMATIC) { if (answers == NULL) - answers = (char **) malloc(sizeof(questions)); + answers = (char **) calloc(1, sizeof(questions)); results = choose_mirror_from_list(http_proxy_host, http_proxy_port, "ftp", &answers[0], &answers[1]); @@ -1159,7 +1159,7 @@ enum return_type http_prepare(void) if (!IS_AUTOMATIC) { if (answers == NULL) - answers = (char **) malloc(sizeof(questions)); + answers = (char **) calloc(1, sizeof(questions)); results = choose_mirror_from_list(http_proxy_host, http_proxy_port, "http", &answers[0], &answers[1]); diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c index 6bdded9d3..c0489b58d 100644 --- a/mdk-stage1/newt-frontend.c +++ b/mdk-stage1/newt-frontend.c @@ -361,7 +361,7 @@ enum return_type ask_from_entries(char *msg, char ** questions, char *** answers entries[i].value = NULL; if (*answers == NULL) - *answers = (char **) malloc(sizeof(char *) * i); + *answers = (char **) calloc(1, sizeof(char *) * i); else already_answers = *answers; diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c index d82f4852d..8c09330b5 100644 --- a/mdk-stage1/stdio-frontend.c +++ b/mdk-stage1/stdio-frontend.c @@ -325,7 +325,7 @@ enum return_type ask_from_entries(char *msg, char ** questions, char *** answers } if (*answers == NULL) - *answers = (char **) malloc(sizeof(char *) * i); + *answers = (char **) calloc(1, sizeof(char *) * i); else already_answers = *answers; -- cgit v1.2.1