FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 09-22-2011, 09:19 AM
Vratislav Podzimek
 
Default Fix sigsegv in setKickstartNetwork() (strdup() from a NULL).

This is definitely a better and safer way how to do it and it shouldn't
cause any problems.

On Wed, 2011-09-21 at 13:43 +0200, Ales Kozumplik wrote:
> See also 88eaea1d9e3811e08e56174f93d9362e95494e77.
>
> Resolves: rhbz#734967
> ---
> loader/kickstart.c | 24 ++++++++++--------------
> 1 files changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/loader/kickstart.c b/loader/kickstart.c
> index f96a7a9..ebb249d 100644
> --- a/loader/kickstart.c
> +++ b/loader/kickstart.c
> @@ -681,7 +681,6 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
> Py_ssize_t i;
> PyObject *list = getDataList(handler, "network");
> iface_t iface;
> - gboolean device_flushed = FALSE;
> char *cmdline_device = NULL;
>
> if (!list)
> @@ -783,11 +782,12 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
> loaderData->netDev_set = 1;
> logMessage(INFO, "kickstart network command - device %s", loaderData->netDev);
> } else {
> - cmdline_device = strdup(loaderData->netDev);
> - loaderData->netDev_set = 0;
> - free(loaderData->netDev);
> - loaderData->netDev = NULL;
> - device_flushed = TRUE;
> + if (loaderData->netDev) {
> + /* save it so we can use it if wifi activation fails */
> + cmdline_device = loaderData->netDev;
> + loaderData->netDev = NULL;
> + loaderData->netDev_set = 0;
> + }
> logMessage(INFO, "kickstart network command - unspecified device");
> }
>
> @@ -851,12 +851,10 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
> ibft_present())) {
> logMessage(INFO, "activating first device from kickstart because network is needed");
> if (process_kickstart_wifi(loaderData) != WIFI_ACTIVATION_OK) {
> - if (device_flushed) {
> - loaderData->netDev = strdup(cmdline_device);
> + if (cmdline_device) {
> + loaderData->netDev = cmdline_device;
> loaderData->netDev_set = 1;
> - free(cmdline_device);
> cmdline_device = NULL;
> - device_flushed = FALSE;
> }
> activateDevice(loaderData, &iface);
> }
> @@ -867,12 +865,10 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
> if (isTrue(attr)) {
> logMessage(INFO, "activating because --activate flag is set");
> if (process_kickstart_wifi(loaderData) != WIFI_ACTIVATION_OK) {
> - if (device_flushed) {
> - loaderData->netDev = strdup(cmdline_device);
> + if (cmdline_device) {
> + loaderData->netDev = cmdline_device;
> loaderData->netDev_set = 1;
> - free(cmdline_device);
> cmdline_device = NULL;
> - device_flushed = FALSE;
> }
> activateDevice(loaderData, &iface);
> }

--
Vratislav Podzimek


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 04:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org