From cc285e06f07d1bf4a6793cd9950c2aa05fb966cd Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Thu, 23 Mar 2006 22:16:33 +0000 Subject: Check for NULL (#186210). --- ChangeLog | 2 ++ loader2/urls.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 807326ba5..cddc7aa37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ * partedUtils.py (DiskSet.openDevices): Ignore disks listed in ignoredisks, even if we have clearpart --all (#186438). + * loader2/urls.c (convertURLToUI): Check for NULL (#186210). + 2006-03-22 David Cantrell * fsset.py (reiserfsFileSystem): Added missing labelDevice method. diff --git a/loader2/urls.c b/loader2/urls.c index a674298dc..d34fbefcb 100644 --- a/loader2/urls.c +++ b/loader2/urls.c @@ -75,11 +75,17 @@ int convertURLToUI(char *url, struct iurlinfo *ui) { /* url is left pointing at the hostname */ chptr = strchr(url, '/'); - *chptr = '\0'; - ui->address = strdup(url); - url = chptr; - *url = '/'; - ui->prefix = strdup(url); + if (chptr != NULL) { + *chptr = '\0'; + ui->address = strdup(url); + url = chptr; + *url = '/'; + ui->prefix = strdup(url); + } + else { + ui->address = strdup(url); + ui->prefix = strdup("/"); + } logMessage(DEBUGLVL, "url address %s", ui->address); logMessage(DEBUGLVL, "url prefix %s", ui->prefix); -- cgit