diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-18 00:59:43 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-18 00:59:43 +0100 |
commit | f57664ddd0ad29ee60e8218f210a3b4ace494da5 (patch) | |
tree | e682702827476ee264a8139f2f03172846f15068 | |
parent | 773d14e740fadfc13687a3ff78bf8106380a346c (diff) | |
download | xK-f57664ddd0ad29ee60e8218f210a3b4ace494da5.tar.gz xK-f57664ddd0ad29ee60e8218f210a3b4ace494da5.tar.xz xK-f57664ddd0ad29ee60e8218f210a3b4ace494da5.zip |
degesch: add an assertion
It should never fail with current code.
-rw-r--r-- | degesch.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -5325,9 +5325,13 @@ mode_processor_do_user (struct mode_processor *self) || !(channel_user = irc_channel_get_user (self->channel, user))) return; + // Translate mode character to user prefix character const char *all_prefixes = self->s->irc_chanuser_prefixes; const char *all_modes = self->s->irc_chanuser_modes; - char prefix = all_prefixes[strchr (all_modes, self->mode_char) - all_modes]; + + const char *mode = strchr (all_modes, self->mode_char); + hard_assert (mode && (size_t) (mode - all_modes) < strlen (all_prefixes)); + char prefix = all_prefixes[mode - all_modes]; struct str *prefixes = &channel_user->prefixes; const char *pos = strchr (prefixes->str, prefix); |