Remove strcpy/strncpy function callings from supplicant

This commit is contained in:
Kapil Gupta 2022-06-02 19:09:24 +05:30
parent 916a4d6524
commit 2aa6853d3e
3 changed files with 6 additions and 9 deletions

View File

@ -281,9 +281,6 @@ char * ets_strdup(const char *s);
#ifndef os_strncmp
#define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
#endif
#ifndef os_strncpy
#define os_strncpy(d, s, n) strncpy((d), (s), (n))
#endif
#ifndef os_strrchr
#define os_strrchr(s, c) strrchr((s), (c))
#endif

View File

@ -661,7 +661,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2;
goto _out;
}
os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1);
os_strlcpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1);
sm->blob[0].len = g_wpa_client_cert_len;
sm->blob[0].data = g_wpa_client_cert;
}
@ -672,7 +672,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2;
goto _out;
}
os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1);
os_strlcpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1);
sm->blob[1].len = g_wpa_private_key_len;
sm->blob[1].data = g_wpa_private_key;
}
@ -683,7 +683,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2;
goto _out;
}
os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1);
os_strlcpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1);
sm->blob[2].len = g_wpa_ca_cert_len;
sm->blob[2].data = g_wpa_ca_cert;
}
@ -694,7 +694,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2;
goto _out;
}
os_strncpy(sm->blob[3].name, "blob://", 8);
os_strlcpy(sm->blob[3].name, "blob://", 8);
sm->blob[3].len = g_wpa_pac_file_len;
sm->blob[3].data = g_wpa_pac_file;
}

View File

@ -1115,9 +1115,9 @@ static struct wpabuf * eap_peap_process(struct eap_sm *sm, void *priv,
* label by default, but allow it to be configured with
* phase1 parameter peaplabel=1. */
if (data->peap_version > 1 || data->force_new_label)
strcpy(label, "client PEAP encryption");
os_strlcpy(label, "client PEAP encryption", 24);
else
strcpy(label, "client EAP encryption");
os_strlcpy(label, "client EAP encryption", 24);
wpa_printf(MSG_DEBUG, "EAP-PEAP: using label '%s' in "
"key derivation", label);
data->key_data =