]> git.itanic.dy.fi Git - linux-stable/commitdiff
Bluetooth: increase BTNAMSIZ to 21 chars to fix potential buffer overflow
authorColin Ian King <colin.king@canonical.com>
Wed, 4 Aug 2021 15:09:51 +0000 (16:09 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Aug 2021 13:05:37 +0000 (15:05 +0200)
An earlier commit replaced using batostr to using %pMR sprintf for the
construction of session->name. Static analysis detected that this new
method can use a total of 21 characters (including the trailing '\0')
so we need to increase the BTNAMSIZ from 18 to 21 to fix potential
buffer overflows.

Addresses-Coverity: ("Out-of-bounds write")
Fixes: fcb73338ed53 ("Bluetooth: Use %pMR in sprintf/seq_printf instead of batostr")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/cmtp/cmtp.h

index c32638dddbf9409d685c3436eb1b1541d04d5a9e..f6b9dc4e408f23754c5f71df3de63299488d5a80 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/types.h>
 #include <net/bluetooth/bluetooth.h>
 
-#define BTNAMSIZ 18
+#define BTNAMSIZ 21
 
 /* CMTP ioctl defines */
 #define CMTPCONNADD    _IOW('C', 200, int)