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>
This commit is contained in:
parent
8b44ad7e16
commit
5e24dc8a4b
18 changed files with 51 additions and 116 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue