If we set the bluetooth name length as maximum 248 bytes, then while retrieving back we were getting only 247 bytes. This problem can be verified using hciconfig tool. --- lib/hci.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/hci.c b/lib/hci.c index 269c021..9f829c9 100644 --- a/lib/hci.c +++ b/lib/hci.c @@ -1417,8 +1417,9 @@ int hci_read_local_name(int dd, int len, char *name, int to) return -1; } - rp.name[247] = '\0'; - strncpy(name, (char *) rp.name, len); + strncpy(name, (char *) rp.name, len - 1); + name[len - 1] = '\0'; + return 0; } -- 1.7.4.1 -- 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