summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/index.c
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2001-07-02 00:18:04 +0000
committerdd <dd@FreeBSD.org>2001-07-02 00:18:04 +0000
commit4a798fb83a60241d607536db8b69d9709995a803 (patch)
treeeb3e6d3ae80fce772bbe283df44e815263d1b83f /usr.sbin/sysinstall/index.c
parentb1763d41ddf8b57a46b69e3e8423b9d57392bd6a (diff)
downloadFreeBSD-src-4a798fb83a60241d607536db8b69d9709995a803.zip
FreeBSD-src-4a798fb83a60241d607536db8b69d9709995a803.tar.gz
Introduce DEVICE_INIT, DEVICE_GET, and DEVICE_SHUTDOWN macros. As the
names suggest, they perform methods on Device's. In addition, they check that the pointer passed to them is valid; if it isn't, they pretend that the action failed. This fixes some crashes due to NULL dereferences (e.g., PR 26509). Approved by: jkh (some time ago)
Diffstat (limited to 'usr.sbin/sysinstall/index.c')
-rw-r--r--usr.sbin/sysinstall/index.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c
index b6d5c00..c30403a 100644
--- a/usr.sbin/sysinstall/index.c
+++ b/usr.sbin/sysinstall/index.c
@@ -727,21 +727,21 @@ index_initialize(char *path)
}
/* Does it move when you kick it? */
- if (!mediaDevice->init(mediaDevice)) {
+ if (!DEVICE_INIT(mediaDevice)) {
restorescr(w);
return DITEM_FAILURE;
}
dialog_clear_norefresh();
msgNotify("Attempting to fetch %s file from selected media.", path);
- fp = mediaDevice->get(mediaDevice, path, TRUE);
+ fp = DEVICE_GET(mediaDevice, path, TRUE);
if (!fp) {
msgConfirm("Unable to get packages/INDEX file from selected media.\n\n"
"This may be because the packages collection is not available\n"
"on the distribution media you've chosen, most likely an FTP site\n"
"without the packages collection mirrored. Please verify that\n"
"your media, or your path to the media, is correct and try again.");
- mediaDevice->shutdown(mediaDevice);
+ DEVICE_SHUTDOWN(mediaDevice);
restorescr(w);
return DITEM_FAILURE;
}
OpenPOWER on IntegriCloud