From 08006c16f85ff60278c54178180fd9e7ca36d3d1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 10 Feb 2016 21:16:28 -0600 Subject: [PATCH] msgbuf: do a better job of handling gotchas with parsing tags --- ircd/msgbuf.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ircd/msgbuf.c b/ircd/msgbuf.c index e3f53892..ab80e45c 100644 --- a/ircd/msgbuf.c +++ b/ircd/msgbuf.c @@ -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 > next) + eq = NULL; + } if (eq != NULL) - *eq = '\0'; + *eq++ = '\0'; - msgbuf_append_tag(msgbuf, t, eq); + if (*t && *t != ' ') + msgbuf_append_tag(msgbuf, t, eq); + else + break; if (next != NULL) t = next + 1; else break; } + + *ch++ = '\0'; } }