From 439de080e210d17c3809e096cbe8b3ac5ab21144 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 19 Sep 2006 21:15:54 +0000 Subject: Add proper UTF-8 validation of device names (both local and remote) --- hcid/security.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'hcid/security.c') 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); } -- cgit