aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer/tncc.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-04-27 20:44:59 (GMT)
committerJouni Malinen <j@w1.fi>2013-04-27 20:44:59 (GMT)
commit5e24dc8a4bc8297dee3b95594457a51d36fde00d (patch)
tree4a97b61e2333269d577fee2187ea03c4dec603d1 /src/eap_peer/tncc.c
parent8b44ad7e162203db56056503d806246ee6a2ad0f (diff)
downloadhostap-5e24dc8a4bc8297dee3b95594457a51d36fde00d.zip
hostap-5e24dc8a4bc8297dee3b95594457a51d36fde00d.tar.gz
hostap-5e24dc8a4bc8297dee3b95594457a51d36fde00d.tar.bz2
Add dup_binstr() to help common binary string tasks
There are quite a few places in the current implementation where a nul terminated string is generated from binary data. Add a helper function to simplify the code a bit. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_peer/tncc.c')
-rw-r--r--src/eap_peer/tncc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/eap_peer/tncc.c b/src/eap_peer/tncc.c
index f5edfd5..a3ec395 100644
--- a/src/eap_peer/tncc.c
+++ b/src/eap_peer/tncc.c
@@ -741,12 +741,10 @@ enum tncc_process_res tncc_process_if_tnccs(struct tncc_data *tncc,
enum tncc_process_res res = TNCCS_PROCESS_OK_NO_RECOMMENDATION;
int recommendation_msg = 0;
- buf = os_malloc(len + 1);
+ buf = dup_binstr(msg, len);
if (buf == NULL)
return TNCCS_PROCESS_ERROR;
- os_memcpy(buf, msg, len);
- buf[len] = '\0';
start = os_strstr(buf, "<TNCCS-Batch ");
end = os_strstr(buf, "</TNCCS-Batch>");
if (start == NULL || end == NULL || start > end) {