3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 06:02:39 +01:00

util: Add util_ssid_is_utf8

This commit is contained in:
Denis Kenzior 2015-04-08 13:18:35 -05:00
parent b2e1c36cbb
commit 3877a4e5dd
2 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,14 @@ no_ssid:
return buf; return buf;
} }
bool util_ssid_is_utf8(size_t len, const uint8_t *ssid)
{
if (len > 32)
return false;
return l_utf8_validate((const char *)ssid, len, NULL);
}
bool _msg_append_attr(struct l_genl_msg *msg, bool _msg_append_attr(struct l_genl_msg *msg,
uint16_t type, const char *type_str, uint16_t type, const char *type_str,
uint16_t len, const void *value) uint16_t len, const void *value)

View File

@ -27,6 +27,7 @@
#include <unistd.h> #include <unistd.h>
const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid); const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid);
bool util_ssid_is_utf8(size_t len, const uint8_t *ssid);
static inline uint8_t util_bit_field(const uint8_t oct, int start, int num) static inline uint8_t util_bit_field(const uint8_t oct, int start, int num)
{ {