diff options
author | June McEnroe <june@causal.agency> | 2023-02-07 11:17:48 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2023-02-07 11:17:48 -0500 |
commit | 625de6979e28269bf27b9d35f4e2bb030ad2920a (patch) | |
tree | fcf7dae5e1868ece448d0bbb00c156afb7272a7b | |
parent | Fix segfault parsing line with only tags (diff) | |
download | pounce-625de6979e28269bf27b9d35f4e2bb030ad2920a.tar.gz pounce-625de6979e28269bf27b9d35f4e2bb030ad2920a.zip |
Set msg.cmd to NULL if it is empty string
This fixes allowing empty lines from clients during registration.
Diffstat (limited to '')
-rw-r--r-- | bounce.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/bounce.h b/bounce.h index 93a3c89..a197053 100644 --- a/bounce.h +++ b/bounce.h @@ -72,6 +72,7 @@ static inline struct Message parse(char *line) { if (line && line[0] == '@') msg.tags = 1 + strsep(&line, " "); if (line && line[0] == ':') msg.origin = 1 + strsep(&line, " "); msg.cmd = strsep(&line, " "); + if (msg.cmd && !msg.cmd[0]) msg.cmd = NULL; for (size_t i = 0; line && i < ParamCap; ++i) { if (line[0] == ':') { msg.params[i] = &line[1]; |