solanum/ircd
Simon Arlott 87c44482d0 ircd: chmode: Avoid referencing beyond the end of the flags_list array in set_channel_mode
We're setting flags to flags_list[3] at the end of the loop, but the
array only has 3 elements. Unless the compiler optimises this away
(because flags will not be used again) we're accessing memory beyond
the end of the array.

With gcc-4.9:
chmode.c: In function 'set_channel_mode':
chmode.c:1548:54: warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations]
  for(j = 0, flags = flags_list[0]; j < 3; j++, flags = flags_list[j])
                                                      ^
chmode.c:1548:2: note: containing loop
  for(j = 0, flags = flags_list[0]; j < 3; j++, flags = flags_list[j])

Explicitly set "flags = flags_list[j]" at the start of each loop
iteration, which will avoid referencing off the end of the array.
2016-02-09 10:41:37 -06:00
..
.depend rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
.indent.pro rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
authd.c authd: fix ratbox3.1-ism 2016-01-06 21:25:07 -06:00
bandbi.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
blacklist.c ircd: move DNS resolution over to authd 2016-01-08 06:31:08 -06:00
cache.c ircd: ensure irc_dictionary users have names, for stats tracking. 2016-01-09 01:22:11 -06:00
capability.c ircd: ensure irc_dictionary users have names, for stats tracking. 2016-01-09 01:22:11 -06:00
channel.c TOPIC: strip channel topic colors here if configured, instead of in set_channel_topic() 2016-01-13 17:17:14 -06:00
chmode.c ircd: chmode: Avoid referencing beyond the end of the flags_list array in set_channel_mode 2016-02-09 10:41:37 -06:00
class.c Revert "ircd: rework sendq limits a bit." 2016-01-20 22:27:33 -05:00
client.c ircd: import modified version of ratbox 3.1 whowas code 2016-01-23 11:16:34 -05:00
dns.c ircd/dns: implement final version of authd-dns line protocol 2016-01-08 05:44:05 -06:00
extban.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
getopt.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
hash.c ircd: hash: remove some detritus 2016-01-23 11:44:08 -05:00
hook.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
hostmask.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
ipv4_from_ipv6.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
irc_dictionary.c ircd: make STATS B easier to understand 2016-01-09 06:23:13 -06:00
irc_radixtree.c ircd: radixtree: allow irc_radixtree_elem_find() to find a fuzzy match instead of an exact match 2016-01-20 22:10:35 -05:00
ircd.c ircd: import modified version of ratbox 3.1 whowas code 2016-01-23 11:16:34 -05:00
ircd_lexer.c ircd: add new lex/yacc files 2016-01-06 22:50:54 -06:00
ircd_lexer.l ircd: add new lex/yacc files 2016-01-06 22:50:54 -06:00
ircd_parser.c ircd: add new lex/yacc files 2016-01-06 22:50:54 -06:00
ircd_parser.h ircd: add new lex/yacc files 2016-01-06 22:50:54 -06:00
ircd_parser.y general: remove last vestiges of static modules support (this hasn't ever actually worked...) 2016-01-06 01:28:20 -06:00
ircd_signal.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
listener.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
logger.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
main.c ircd: add main.c stub executable 2016-01-06 23:57:35 -06:00
Makefile.am ircd: add irc_radixtree, which is like irc_dictionary but uses a radix tree as the backing store 2016-01-09 00:44:39 -06:00
Makefile.in ircd: add irc_radixtree, which is like irc_dictionary but uses a radix tree as the backing store 2016-01-09 00:44:39 -06:00
match.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
modules.c ircd: implement support for remote module load/unload/etc commands 2016-01-12 00:37:54 -06:00
monitor.c ircd: monitor: use irc_radixtree instead of home-grown hashtable 2016-01-23 10:35:40 -05:00
newconf.c ircd: newconf: impose a deprecation warning for plaintext listeners 2016-01-29 11:35:05 -05:00
operhash.c ircd: operhash: rewrite to use irc_radixtree 2016-01-09 01:08:15 -06:00
packet.c Revert "ircd: rework sendq limits a bit." 2016-01-20 22:27:33 -05:00
parse.c parse: implement reconstruct_parv() 2016-01-11 22:28:55 -06:00
privilege.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
ratelimit.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
reject.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
restart.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
s_auth.c ircd: move DNS resolution over to authd 2016-01-08 06:31:08 -06:00
s_conf.c ircd: call rehash_authd(), not restart_authd() when rehashing 2016-01-16 00:04:07 -06:00
s_newconf.c ircd: hash: use an irc_radixtree for storing resv's 2016-01-09 04:59:02 -06:00
s_serv.c ircd: remove internal resolver, no longer used 2016-01-08 06:39:51 -06:00
s_user.c ircd: import modified version of ratbox 3.1 whowas code 2016-01-23 11:16:34 -05:00
scache.c ircd: scache: use irc_radixtree 2016-01-09 05:55:46 -06:00
send.c Revert "ircd: rework sendq limits a bit." 2016-01-20 22:27:33 -05:00
snomask.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
sslproc.c sslproc: process title of ssld seemed gramatically weird (nitpicking) 2016-01-06 02:15:23 -06:00
substitution.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
supported.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
tgchange.c rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
version.c.SH rename src to ircd, libcore to libircd 2016-01-06 01:16:08 -06:00
whowas.c ircd: import modified version of ratbox 3.1 whowas code 2016-01-23 11:16:34 -05:00