diff --git a/components/wpa_supplicant/port/include/os.h b/components/wpa_supplicant/port/include/os.h index 5955d2c38c..6729f02408 100644 --- a/components/wpa_supplicant/port/include/os.h +++ b/components/wpa_supplicant/port/include/os.h @@ -263,8 +263,7 @@ char * ets_strdup(const char *s); #define os_strncpy(d, s, n) strncpy((d), (s), (n)) #endif #ifndef os_strrchr -//hard cold -#define os_strrchr(s, c) NULL +#define os_strrchr(s, c) strrchr((s), (c)) #endif #ifndef os_strstr #define os_strstr(h, n) strstr((h), (n)) diff --git a/components/wpa_supplicant/src/utils/common.c b/components/wpa_supplicant/src/utils/common.c index 12d703ec9f..ef2225b705 100644 --- a/components/wpa_supplicant/src/utils/common.c +++ b/components/wpa_supplicant/src/utils/common.c @@ -269,8 +269,21 @@ char * wpa_config_parse_string(const char *value, size_t *len) } else { u8 *str; size_t tlen, hlen = os_strlen(value); +#ifndef ESP_SUPPLICANT if (hlen & 1) return NULL; +#else + if (hlen == 5 || hlen == 13) { + *len = hlen; + str = (u8 *)os_malloc(*len + 1); + if (str == NULL) { + return NULL; + } + memcpy(str, value, *len); + str[*len] = '\0'; + return (char *) str; + } +#endif tlen = hlen / 2; str = os_malloc(tlen + 1); if (str == NULL)