From 0040e135e587c476abd7d99d7a47ae146bad0f55 Mon Sep 17 00:00:00 2001 From: Monsta Date: Wed, 19 Nov 2014 21:18:59 +0300 Subject: Fixed logic flow (out-of-bounds array access if bluetooth is disabled) --- src/share-extension.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/share-extension.c b/src/share-extension.c index bbc34ff..213b044 100644 --- a/src/share-extension.c +++ b/src/share-extension.c @@ -145,7 +145,7 @@ caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface, const GUserDirectory special_dirs[] = { G_USER_DIRECTORY_PUBLIC_SHARE }; gboolean is_dir[] = { FALSE }; -#endif +#endif /* HAVE_BLUETOOTH */ file = g_file_new_for_uri (uri); home = g_file_new_for_path (g_get_home_dir ()); @@ -171,14 +171,16 @@ caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface, if (enable == FALSE) return NULL; - if (is_dir[0] != FALSE && is_dir[1] != FALSE) { - bar = caja_share_bar_new (_("May be used to share or receive files")); - } else if (is_dir[0] != FALSE) { -#ifndef HAVE_BLUETOOTH - bar = caja_share_bar_new (_("May be shared over the network or Bluetooth")); + if (is_dir[0] != FALSE) { +#ifdef HAVE_BLUETOOTH + if (is_dir[1] != FALSE) { + bar = caja_share_bar_new (_("May be used to share or receive files")); + } else { + bar = caja_share_bar_new (_("May be shared over the network or Bluetooth")); + } #else bar = caja_share_bar_new (_("May be shared over the network")); -#endif /* !HAVE_BLUETOOTH */ +#endif /* HAVE_BLUETOOTH */ } else { #ifdef HAVE_BLUETOOTH BluetoothClient *client; -- cgit v1.2.1