libnm: expose NM_IW_ESSID_MAX_SIZE define

This commit is contained in:
Thomas Haller 2021-03-18 11:29:45 +01:00
parent 1708e9a3cc
commit cd00b04099
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 6 additions and 4 deletions

View file

@ -366,4 +366,8 @@ typedef struct {
/****************************************************************************/
#define NM_IW_ESSID_MAX_SIZE 32
/****************************************************************************/
#endif /* __NM_LIBNM_BASE_H__ */

View file

@ -633,8 +633,6 @@ nm_utils_is_empty_ssid(const guint8 *ssid, gsize len)
return _nm_utils_is_empty_ssid_arr(ssid, len);
}
#define ESSID_MAX_SIZE 32
/**
* nm_utils_escape_ssid:
* @ssid: (array length=len): pointer to a buffer containing the SSID data
@ -651,7 +649,7 @@ nm_utils_is_empty_ssid(const guint8 *ssid, gsize len)
const char *
nm_utils_escape_ssid(const guint8 *ssid, gsize len)
{
static char escaped[ESSID_MAX_SIZE * 2 + 1];
static char escaped[NM_IW_ESSID_MAX_SIZE * 2 + 1];
const guint8 *s = ssid;
char * d = escaped;
@ -660,7 +658,7 @@ nm_utils_escape_ssid(const guint8 *ssid, gsize len)
return escaped;
}
len = MIN(len, (guint32) ESSID_MAX_SIZE);
len = MIN(len, (guint32) NM_IW_ESSID_MAX_SIZE);
while (len--) {
if (*s == '\0') {
*d++ = '\\';