diff options
author | Claudiu Olteanu <claudiu@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-03-28 21:41:12 +0000 |
---|---|---|
committer | Claudiu Olteanu <claudiu@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-03-28 21:41:12 +0000 |
commit | 2c3a332d522d0fa9400fa7e51a0bb32d9ed2b68f (patch) | |
tree | 6a0403778eef280fa9d0d13cbf8ff9e19fc76043 /src/transport/gnunet-helper-transport-bluetooth.c | |
parent | f44ded605090e7ed31dd1a25b439139b2bdf59f3 (diff) | |
download | gnunet-2c3a332d522d0fa9400fa7e51a0bb32d9ed2b68f.tar.gz gnunet-2c3a332d522d0fa9400fa7e51a0bb32d9ed2b68f.zip |
Fixed the overflow problems reported in issue 3350
Diffstat (limited to 'src/transport/gnunet-helper-transport-bluetooth.c')
-rw-r--r-- | src/transport/gnunet-helper-transport-bluetooth.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c index 3f32edc45..8ccfe6377 100644 --- a/src/transport/gnunet-helper-transport-bluetooth.c +++ b/src/transport/gnunet-helper-transport-bluetooth.c | |||
@@ -97,6 +97,11 @@ | |||
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * In bluez library, the maximum name length of a device is 8 | ||
101 | */ | ||
102 | #define BLUEZ_DEVNAME_SIZE 8 | ||
103 | |||
104 | /** | ||
100 | * struct for storing the information of the hardware. There is only | 105 | * struct for storing the information of the hardware. There is only |
101 | * one of these. | 106 | * one of these. |
102 | */ | 107 | */ |
@@ -1156,7 +1161,7 @@ open_device (struct HardwareInfos *dev) | |||
1156 | 1161 | ||
1157 | memset (&dev_info, 0, sizeof(struct hci_dev_info)); | 1162 | memset (&dev_info, 0, sizeof(struct hci_dev_info)); |
1158 | dev_info.dev_id = request.dev[i].dev_id; | 1163 | dev_info.dev_id = request.dev[i].dev_id; |
1159 | strncpy (dev_info.name, dev->iface, IFNAMSIZ); | 1164 | strncpy (dev_info.name, dev->iface, BLUEZ_DEVNAME_SIZE); |
1160 | 1165 | ||
1161 | if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info)) | 1166 | if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info)) |
1162 | { | 1167 | { |
@@ -1165,7 +1170,7 @@ open_device (struct HardwareInfos *dev) | |||
1165 | return 1; | 1170 | return 1; |
1166 | } | 1171 | } |
1167 | 1172 | ||
1168 | if (strcmp (dev_info.name, dev->iface) == 0) | 1173 | if (strncmp (dev_info.name, dev->iface, BLUEZ_DEVNAME_SIZE) == 0) |
1169 | { | 1174 | { |
1170 | 1175 | ||
1171 | dev_id = dev_info.dev_id; //the device was found | 1176 | dev_id = dev_info.dev_id; //the device was found |