mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
don't modify raw message
This commit is contained in:
parent
36be37ed8b
commit
1cc667a00c
1 changed files with 4 additions and 6 deletions
|
@ -742,6 +742,7 @@ static int wpas__parse_message(struct wpas *w,
|
||||||
const char *ifname = NULL;
|
const char *ifname = NULL;
|
||||||
unsigned int level;
|
unsigned int level;
|
||||||
char *pos;
|
char *pos;
|
||||||
|
char *orig_raw = raw;
|
||||||
int r, num;
|
int r, num;
|
||||||
bool is_event = false;
|
bool is_event = false;
|
||||||
|
|
||||||
|
@ -751,7 +752,7 @@ static int wpas__parse_message(struct wpas *w,
|
||||||
ifname = pos;
|
ifname = pos;
|
||||||
pos = strchrnul(pos, ' ');
|
pos = strchrnul(pos, ' ');
|
||||||
if (*pos)
|
if (*pos)
|
||||||
*pos++ = 0;
|
pos++;
|
||||||
|
|
||||||
len -= pos - raw;
|
len -= pos - raw;
|
||||||
raw = pos;
|
raw = pos;
|
||||||
|
@ -811,15 +812,12 @@ static int wpas__parse_message(struct wpas *w,
|
||||||
|
|
||||||
m->sealed = true;
|
m->sealed = true;
|
||||||
m->rawlen = len;
|
m->rawlen = len;
|
||||||
m->raw = malloc(len + 1);
|
m->raw = strdup(orig_raw);
|
||||||
if (!m->raw)
|
if (!m->raw)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* copy with 0-terminator */
|
|
||||||
memcpy(m->raw, raw, len + 1);
|
|
||||||
|
|
||||||
if (ifname) {
|
if (ifname) {
|
||||||
m->ifname = strdup(ifname);
|
m->ifname = strndup(ifname, strchrnul(ifname, ' ') - ifname);
|
||||||
if (!m->ifname)
|
if (!m->ifname)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue