]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
Fix OOB read (1 byte to the left)
authorBram Matthys <redacted>
Mon, 11 Jun 2018 06:05:14 +0000 (08:05 +0200)
committerBram Matthys <redacted>
Mon, 11 Jun 2018 06:05:14 +0000 (08:05 +0200)
src/modules/m_mode.c

index 5de32d04b66b4919c3698d71263b66f8afb56072..2a9bb30b500d1421e64c366be44eb1f440270a93 100644 (file)
@@ -695,7 +695,7 @@ void make_mode_str(aChannel *chptr, long oldm, Cmode_t oldem, long oldl, int pco
                chptr->mode.extmode = oldem;
        }
        z = strlen(para_buf);
-       if (para_buf[z - 1] == ' ')
+       if ((z > 0) && (para_buf[z - 1] == ' '))
                para_buf[z - 1] = '\0';
        *x = '\0';
        if (*mode_buf == '\0')