diff --git a/Changes b/Changes index 321c2bb2f..412baa440 100644 --- a/Changes +++ b/Changes @@ -2236,3 +2236,5 @@ seen. gmtime warning still there is disabled by default at newer *BSD versions. Also improved another warning. - Added set::channel-command-prefix to allow channel text which starts with specific characters to be sent to +d clients (for in channel commands). +- Added a README +- Added some checking in fdlist add/remove functions. diff --git a/README b/README new file mode 100644 index 000000000..d8edfebc5 --- /dev/null +++ b/README @@ -0,0 +1,24 @@ +==[ COMPILING ]== +To build the ircd, run: +./Config +make + +If you specified an alternative location during ./Config you also need +to run "make install". + +==[ MAKING A CONFIG FILE ]== +If you are new, then you need to create your own configfile: + +copy doc/example.conf to your main UnrealIRCd directory and call +it unrealircd.conf . +Then open it in an editor and carefully modify it, consult the docs +(doc/unreal32docs.html, or online: www.unrealircd.com/unreal32docs.html) +for more information about every block/setting. +Common problems are explained in the FAQ, which is located at: +http://www.vulnscan.org/UnrealIrcd/faq/ . + +==[ BOOTING YOUR IRCD ]== +Just type: ./unreal start +Note that after booting the errors are usually logged to ircd.log, +so check that file if you have any problems. +Again, check the FAQ (and docs) if you have any boot problems. diff --git a/src/fdlist.c b/src/fdlist.c index f6c939516..4cac34f65 100644 --- a/src/fdlist.c +++ b/src/fdlist.c @@ -27,10 +27,27 @@ #include "fdlist.h" #include +extern fdlist default_fdlist; +extern fdlist busycli_fdlist; +extern fdlist serv_fdlist; +extern fdlist oper_fdlist; + void addto_fdlist(int fd, fdlist * listp) { int index; + /* I prefer this little 5-cpu-cycles-check over memory corruption. -- Syzop */ + if ((fd < 0) || (fd >= MAXCONNECTIONS)) + { + sendto_realops("[BUG] trying to add fd #%d to 0x%x (%x/%x/%x/%x), range is 0..%d", + fd, listp, &default_fdlist, &busycli_fdlist, &serv_fdlist, &oper_fdlist, + MAXCONNECTIONS); + ircd_log(LOG_ERROR, "[BUG] trying to add fd #%d to 0x%x (%x/%x/%x/%x), range is 0..%d", + fd, listp, &default_fdlist, &busycli_fdlist, &serv_fdlist, &oper_fdlist, + MAXCONNECTIONS); + return; + } + if ((index = ++listp->last_entry) >= MAXCONNECTIONS) { /* @@ -49,6 +66,18 @@ void delfrom_fdlist(int fd, fdlist * listp) { int i; + /* I prefer this little 5-cpu-cycles-check over memory corruption. -- Syzop */ + if ((fd < 0) || (fd >= MAXCONNECTIONS)) + { + sendto_realops("[BUG] trying to remove fd #%d to 0x%x (%x/%x/%x/%x), range is 0..%d", + fd, listp, &default_fdlist, &busycli_fdlist, &serv_fdlist, &oper_fdlist, + MAXCONNECTIONS); + ircd_log(LOG_ERROR, "[BUG] trying to remove fd #%d to 0x%x (%x/%x/%x/%x), range is 0..%d", + fd, listp, &default_fdlist, &busycli_fdlist, &serv_fdlist, &oper_fdlist, + MAXCONNECTIONS); + return; + } + for (i = listp->last_entry; i; i--) { if (listp->entry[i] == fd)