]>
Commit | Line | Data |
---|---|---|
0416a3b3 AM |
1 | diff --git a/src/security.c b/src/security.c |
2 | index 905cf61..67fd266 100644 | |
3 | --- a/src/security.c | |
4 | +++ b/src/security.c | |
5 | @@ -705,8 +705,16 @@ static inline void remote_name_information(int dev, bdaddr_t *sba, void *ptr) | |
6 | memcpy(name, evt->name, MAX_NAME_LENGTH); | |
7 | /* It's ok to cast end between const and non-const since | |
8 | * we know it points to inside of name which is non-const */ | |
9 | - if (!g_utf8_validate(name, -1, (const char **) &end)) | |
10 | - *end = '\0'; | |
11 | + if (!g_utf8_validate(name, -1, (const char **) &end)) { | |
12 | + char *utf8_name; | |
13 | + | |
14 | + utf8_name = g_convert(name, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
15 | + if (utf8_name) { | |
16 | + memcpy(name, utf8_name, 248); | |
17 | + g_free(utf8_name); | |
18 | + } else | |
19 | + *end = '\0'; | |
20 | + } | |
21 | write_device_name(sba, &dba, name); | |
22 | } | |
23 |