Commit Graph

536 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
52e2d7a8c8 shared/util: Introduce bt_appear_to_str
This adds bt_appear_to_str which can decode the appearance code to a
human readable string.
2017-12-21 10:08:22 -02:00
Bastien Nocera
c133489d54 battery: Add BT SIG reserved number used by Battery Service
Add the Battery Level UUID as per:
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_level.xml
2017-11-03 13:00:57 +02:00
Brian Gix
1a1204666e mesh: Add BT SIG reserved numbers for Mesh 2017-08-21 12:40:35 +02:00
Marcel Holtmann
fd06b6b46d lib: Add version number for Bluetooth 5.0 2017-01-29 21:31:33 -08:00
Tomasz Gorochowik
71ca8b5a59 lib/sdp: Remove deprecated VIDEO_CONF profile id
Commit 75e0c32af6 ("lib/sdp: Replace VIDEO_CONF_SVCLASS_ID with
AV_REMOTE_CONTROLLER_SVCLASS_ID") removed the deprecated
VIDEO_CONF_SVCLASS_ID definition, but left the corresponding profile
definition..

According to the specification linked below A/V_RemoteControlController
UUID can only be used as a service class so its profile definition
should be removed.

https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery
2017-01-16 09:30:36 +02:00
Marcel Holtmann
e4bc2ffa98 lib: Update company identifiers 2016-10-20 10:22:48 +02:00
Marcel Holtmann
ab00bdf4c9 lib: Update company identifiers 2016-09-26 12:09:17 +02:00
Michał Narajowski
3bb8bd1bad lib/mgmt: Add Set Appearance command definition 2016-09-18 16:11:40 +02:00
Marcel Holtmann
5ee33f811a lib: Update company identifiers 2016-09-15 22:06:58 +02:00
Marcel Holtmann
19c9b11831 lib: Add structs and defines for extended controller information 2016-08-29 18:52:18 +02:00
Marcel Holtmann
18360d45ce lib: Add identifier for Qualcomm SMD bus 2016-08-15 09:07:24 +02:00
Luiz Augusto von Dentz
97531e944c lib/uuid: Fix using unitialized values
The strings passed to bt_uuid_strcmp may not be valid UUIDs so the return
of bt_string_to_uuid needs to be checked otherwise bt_uuid_cmp may attempt
to access unitialized values:

Conditional jump or move depends on uninitialised value(s)
   at 0x4C1D4D: bt_uuid_to_uuid128 (uuid.c:78)
   by 0x4C1F22: bt_uuid_cmp (uuid.c:131)
   by 0x4C24A8: bt_uuid_strcmp (uuid.c:286)
   by 0x40F8A8: reconnect_match (policy.c:514)
   by 0x40F8A8: service_cb (policy.c:655)
   by 0x499331: change_state (service.c:109)
   by 0x499BBB: btd_service_connecting_complete (service.c:361)
   by 0x4178C1: stream_state_changed (source.c:163)
   by 0x422C78: avdtp_sep_set_state (avdtp.c:1013)
   by 0x42372A: handle_transport_connect (avdtp.c:844)
   by 0x423D8B: avdtp_connect_cb (avdtp.c:2326)
   by 0x465BBB: connect_cb (btio.c:232)
   by 0x50CA702: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4800.1)
 Uninitialised value was created by a stack allocation
   at 0x4C2460: bt_uuid_strcmp (uuid.c:280)
2016-07-29 14:12:49 +03:00
Marcel Holtmann
91758e0a5f lib: Update company identifiers 2016-07-17 22:54:31 +02:00
Marcel Holtmann
91b1b67b95 lib: Update company identifiers 2016-07-05 21:10:11 +02:00
Marcel Holtmann
12cd2eda1a lib: Define HCI_PRIMARY and use it instead of HCI_BREDR 2016-07-04 19:21:44 +02:00
Marcel Holtmann
a407d371e1 lib: Update company identifiers 2016-05-26 18:50:03 +02:00
Luiz Augusto von Dentz
bf370f3bd6 doc/gatt-api: Add secure flags
This add secure-{read,write} which shall be used by servers that want
to restrict attribute access to secure connection only (BT_SECURITY_FIPS)
2016-05-18 14:16:28 +03:00
Marcel Holtmann
1055cee326 lib: Update company identifiers 2016-05-17 18:51:02 +02:00
Johan Hedberg
bfb16c94ad lib: Add recently introduced SPI & I2C bus defines 2016-04-22 19:24:03 +03:00
Marcel Holtmann
49ad9f8632 lib: Update company identifiers 2016-04-05 00:06:05 +02:00
Marcel Holtmann
9deb4d863b lib: Update company identifiers 2016-03-18 01:03:35 +01:00
Cody P Schafer
7a176b4955 uuid: fix 1 byte stack overflow
scanf requires that '[' convertion specifiers have enough room for all
characters in the string, _plus a terminating null byte_. We were
previously not providing room for the terminating null byte.

This was detected by AddressSanitizer:

==15036==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe4e774401 at pc 0x7fd33f572c98 bp 0x7ffe4e774270 sp 0x7ffe4e7739f8
WRITE of size 2 at 0x7ffe4e774401 thread T0
    #0 0x7fd33f572c97 in scanf_common /build/gcc-multilib/src/gcc-5-20160209/libsanitizer/sanitizer_common/sanitizer_common_interceptors_format.inc:340
    #1 0x7fd33f5739ea in __interceptor_vsscanf /build/gcc-multilib/src/gcc-5-20160209/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:769
    #2 0x7fd33f573b49 in __interceptor_sscanf /build/gcc-multilib/src/gcc-5-20160209/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:793
    #3 0x650db5 in is_base_uuid128 lib/uuid.c:191
    #4 0x65196e in bt_string_to_uuid lib/uuid.c:267
    #5 0x56f28e in parse_uuid src/gatt-database.c:1473
    #6 0x5729e0 in database_add_service src/gatt-database.c:2053
    #7 0x57329f in database_add_app src/gatt-database.c:2106
    #8 0x573adc in client_ready_cb src/gatt-database.c:2211
    #9 0x6695fd in get_managed_objects_reply gdbus/client.c:1097
    #10 0x7fd33efd5391  (/usr/lib/libdbus-1.so.3+0x13391)
    #11 0x7fd33efd8db0 in dbus_connection_dispatch (/usr/lib/libdbus-1.so.3+0x16db0)
    #12 0x651ecd in message_dispatch gdbus/mainloop.c:72
    #13 0x7fd33f25cc39 in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x49c39)
    #14 0x7fd33f25cfdf  (/usr/lib/libglib-2.0.so.0+0x49fdf)
    #15 0x7fd33f25d301 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x4a301)
    #16 0x54b7d1 in main src/main.c:687
    #17 0x7fd33d90870f in __libc_start_main (/usr/lib/libc.so.6+0x2070f)
    #18 0x40bba8 in _start (/home/cody/g/bluez/src/bluetoothd+0x40bba8)

Address 0x7ffe4e774401 is located in stack of thread T0 at offset 33 in frame
    #0 0x650ccd in is_base_uuid128 lib/uuid.c:184

  This frame has 2 object(s):
    [32, 33) 'dummy' <== Memory access at offset 33 overflows this variable
    [96, 98) 'uuid'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /build/gcc-multilib/src/gcc-5-20160209/libsanitizer/sanitizer_common/sanitizer_common_interceptors_format.inc:340 scanf_common
Shadow bytes around the buggy address:
  0x100049ce6830: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100049ce6840: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100049ce6850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100049ce6860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100049ce6870: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
=>0x100049ce6880:[01]f4 f4 f4 f2 f2 f2 f2 02 f4 f4 f4 f3 f3 f3 f3
  0x100049ce6890: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x100049ce68a0: 00 f4 f4 f4 f2 f2 f2 f2 00 00 04 f4 f2 f2 f2 f2
  0x100049ce68b0: 00 00 00 00 00 00 00 00 00 f4 f4 f4 f3 f3 f3 f3
  0x100049ce68c0: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x100049ce68d0: 01 f4 f4 f4 f2 f2 f2 f2 00 00 04 f4 f3 f3 f3 f3
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==15036==ABORTING
2016-03-09 12:46:52 +02:00
Johan Hedberg
43657d7703 mgmt: Add support for Start Limited Discovery 2016-01-05 11:17:39 +02:00
Marcel Holtmann
af77712a79 lib: Update company identifiers 2015-12-27 22:58:45 +01:00
Luiz Augusto von Dentz
0a4ac85042 lib/uuid: Make bt_uuid_to_string always use the same format
The convention has been to use 128 Bits UUID strings so other types must
be converted first.
2015-12-02 10:49:12 +02:00
Marcel Holtmann
745dcb2e32 lib: Add data structures for Get Advertising Size Information command 2015-11-23 14:09:03 +01:00
Johan Hedberg
d6fbf3d4fb lib/mgmt: Update string tables 2015-11-23 10:41:04 +02:00
Marcel Holtmann
d52e7dd260 lib: Fix missing error handling when SDP record is NULL 2015-11-10 15:54:12 +01:00
Marcel Holtmann
3b8f3b7406 lib: Add definition for HCI_CHANNEL_LOGGING 2015-11-07 14:46:18 +01:00
Marcel Holtmann
0b0d4634bd lib: Fix UTF-8 characters in company name 2015-10-30 04:21:55 +01:00
Marcel Holtmann
0b998b6c4f lib: Update company identifiers 2015-10-30 04:18:14 +01:00
Marcel Holtmann
f1235de3fc lib: Update company identifiers 2015-09-26 03:26:35 +02:00
Luiz Augusto von Dentz
e39be1cb2d lib/uuid: Fix bt_uuid_strcmp
bt_uuid_strcmp shall first convert the strings to bt_uuid_t using
bt_string_to_uuid since bt_uuid_to_string can produce different formats
depending on the type.
2015-09-06 20:08:09 +03:00
Marcel Holtmann
e513efa8e4 lib: Update company identifiers 2015-09-04 02:45:52 +02:00
Marcel Holtmann
cb352a0bf2 lib: Update company identifiers 2015-08-26 09:19:16 +02:00
Luiz Augusto von Dentz
9db45f056b lib/sdp: Fix resource leak in sdp_get_supp_feat
In case dtd is unknow it would jump to fail without freeing what has
been allocated in subseq which is not appended to tseq so it could not
be freed.
2015-08-13 14:05:35 +03:00
Marcel Holtmann
8b3b2fd9a0 lib: Update company identifiers 2015-07-30 18:58:22 +02:00
Marcel Holtmann
0fae1f0dc1 lib: Update company identifiers 2015-07-07 19:16:35 +02:00
Marcel Holtmann
0d9053c1ac lib: Update company identifiers 2015-06-15 11:20:03 +02:00
Marcel Holtmann
4df7d9dd37 lib: Update company identifiers 2015-06-01 21:07:54 +02:00
Grzegorz Kolodziejczyk
90012afd11 lib/bnep: Update bnep header with BNEPGETSUPPFEAT and setup response
This patch updates bnep header with get bnep supported features ioctl
xand bnep setup response flag.
2015-05-19 16:31:56 +02:00
Marcel Holtmann
b5093e5688 lib: Update company identifiers 2015-05-17 01:22:51 +02:00
Marcel Holtmann
5acac4bfa7 lib: Update company identifiers 2015-03-31 13:56:19 -07:00
Luiz Augusto von Dentz
5e36d4e8ed lib/uuid: Fix bt_uuid_to_le
bt_uuid_to_le is currently broken if the src uuid is type 32 bits since
it does the conversion to 128 bits but still uses the original value to
swap instead of the coverted one.
2015-03-30 16:49:54 +03:00
Richard Palethorpe
3d9fc0e100 lib: Fix compilation error in C++ due to inline function
This adds explicit typecasts to an inline function to make it C++
compatible. What follows is a sample error message from g++ when
compiling without this patch.

/usr/include/bluetooth/bluetooth.h:
  In function 'void bswap_128(const void*, void*)':
/usr/include/bluetooth/bluetooth.h:348:21:
  error: invalid conversion from 'const void*' to 'const uint8_t*
         {aka const unsigned char*}' [-fpermissive]
  const uint8_t *s = src;
2015-03-30 10:14:07 +03:00
Arman Uguray
4e5c00fc57 lib: Add macros for advertising instance flags
This patch adds macro definitions for possible advertising instance
flags that can be passed to the "Add Advertising" mgmt command.
2015-03-25 19:27:23 -07:00
Arman Uguray
32c93510e8 lib: Provide data structures for Add/Remove Advertising
This patch provides data structures and opcodes for the Add/Remove
Advertising commands and the Advertising Added/Removed events.
2015-03-24 01:47:08 +01:00
Marcel Holtmann
d5e8e85c1b lib: Add management event strings for advertising added/removed 2015-03-16 16:49:24 -07:00
Marcel Holtmann
8ce5d05363 lib: Add mgmt event for local out-of-band data update notification 2015-03-16 16:02:16 -07:00
Johan Hedberg
0d468ec37c lib/mgmt: Update mgmt command string-lookup table 2015-03-16 07:47:23 +02:00