summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2014-11-19 21:18:59 +0300
committerStefano Karapetsas <[email protected]>2015-03-13 09:19:27 +0100
commitf2a4957ae69bf5554ed17fd3e04f183f51e6d5f0 (patch)
treec5ea51687cd14ae467d33b0c0296280c2ac2d9f3
parentc992f2f94c443721e0bd1f54747cc379d3dbd82a (diff)
downloadmate-user-share-f2a4957ae69bf5554ed17fd3e04f183f51e6d5f0.tar.bz2
mate-user-share-f2a4957ae69bf5554ed17fd3e04f183f51e6d5f0.tar.xz
Fixed logic flow (out-of-bounds array access if bluetooth is disabled)
-rw-r--r--src/share-extension.c16
1 files 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;