msgbuf: do a better job of handling gotchas with parsing tags

This commit is contained in:
William Pitcock 2016-02-10 21:16:28 -06:00
parent c84003aeb5
commit 08006c16f8

View file

@ -43,7 +43,7 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
if (*ch == '@')
{
char *t = ch++;
char *t = ch + 1;
ch = strchr(ch, ' ');
if (ch != NULL)
@ -54,21 +54,28 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
char *eq = strchr(t, '=');
if (next != NULL)
{
*next = '\0';
if (eq > next)
eq = NULL;
}
if (eq != NULL)
*eq = '\0';
*eq++ = '\0';
if (*t && *t != ' ')
msgbuf_append_tag(msgbuf, t, eq);
else
break;
if (next != NULL)
t = next + 1;
else
break;
}
*ch++ = '\0';
}
}