Merge branch 'bugfix/supplicant_security_fixes_v3.1' into 'release/v3.1'

wpa_supplicant: Fix sprintf security bugs. (v3.1)

See merge request espressif/esp-idf!5466
This commit is contained in:
Angus Gratton 2019-08-13 09:28:33 +08:00
commit 9196bc7a53
3 changed files with 3 additions and 5 deletions

View File

@ -270,7 +270,7 @@ char * ets_strdup(const char *s);
#ifdef _MSC_VER #ifdef _MSC_VER
#define os_snprintf _snprintf #define os_snprintf _snprintf
#else #else
#define os_snprintf vsnprintf #define os_snprintf snprintf
#endif #endif
#endif #endif

View File

@ -732,8 +732,7 @@ int eap_peer_tls_status(struct eap_sm *sm, struct eap_ssl_data *data,
if (tls_get_cipher(data->ssl_ctx, data->conn, name, sizeof(name)) == 0) if (tls_get_cipher(data->ssl_ctx, data->conn, name, sizeof(name)) == 0)
{ {
//ret = os_snprintf(buf + len, buflen - len, ret = os_snprintf(buf + len, buflen - len,
ret = sprintf(buf + len,
"EAP TLS cipher=%s\n", name); "EAP TLS cipher=%s\n", name);
if (ret < 0 || (size_t) ret >= buflen - len) if (ret < 0 || (size_t) ret >= buflen - len)
return len; return len;

View File

@ -152,8 +152,7 @@ void asn1_oid_to_str(struct asn1_oid *oid, char *buf, size_t len)
buf[0] = '\0'; buf[0] = '\0';
for (i = 0; i < oid->len; i++) { for (i = 0; i < oid->len; i++) {
//ret = os_snprintf(pos, buf + len - pos, ret = os_snprintf(pos, buf + len - pos,
ret = sprintf(pos,
"%s%lu", "%s%lu",
i == 0 ? "" : ".", oid->oid[i]); i == 0 ? "" : ".", oid->oid[i]);
if (ret < 0 || ret >= buf + len - pos) if (ret < 0 || ret >= buf + len - pos)