[PATCHv3 4/4] android: Fix printing not NULL terminated strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Android passes not NULL terminated strings.
---
 android/client/textconv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/client/textconv.c b/android/client/textconv.c
index 8e6bdb9..9a2f7e6 100644
--- a/android/client/textconv.c
+++ b/android/client/textconv.c
@@ -258,7 +258,8 @@ char *btproperty2str(const bt_property_t *property)
 	switch (property->type) {
 	case BT_PROPERTY_BDNAME:
 	case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
-		sprintf(p, "%s", ((bt_bdname_t *) property->val)->name);
+		snprintf(p, property->len + 1, "%s",
+					((bt_bdname_t *) property->val)->name);
 		break;
 
 	case BT_PROPERTY_BDADDR:
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux