summaryrefslogtreecommitdiffstats
path: root/hcid/security.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-09-19 21:15:54 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-09-19 21:15:54 +0000
commit439de080e210d17c3809e096cbe8b3ac5ab21144 (patch)
tree7ab9b9d65291a440294075f7165207074ffbd31f /hcid/security.c
parent4b0b4c6b25a119e7011d2da9827481a6c1690dc0 (diff)
Add proper UTF-8 validation of device names (both local and remote)
Diffstat (limited to 'hcid/security.c')
-rw-r--r--hcid/security.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hcid/security.c b/hcid/security.c
index d44bfea4..e1c29ea9 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -464,7 +464,10 @@ static inline void remote_name_information(int dev, bdaddr_t *sba, void *ptr)
bacpy(&dba, &evt->bdaddr);
if (!evt->status) {
+ char *end;
memcpy(name, evt->name, 248);
+ if (!g_utf8_validate(name, -1, &end))
+ *end = '\0';
write_device_name(sba, &dba, name);
}