CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2003-01-11 11:24:32 UTC
Modified files:
ChangeLog ircd/client.c ircd/ircd_features.c
Log message:
fix coredump in feature lookup code
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.371 ircu2.10/ChangeLog:1.372
--- ircu2.10/ChangeLog:1.371 Fri Jan 10 21:46:50 2003
+++ ircu2.10/ChangeLog Sat Jan 11 03:24:21 2003
@@ -1,3 +1,10 @@
+2003-01-11 Thomas Helvey <[EMAIL PROTECTED]>
+ * ircd/client.c, ircd/ircd_feature.c: Bugfix, the feature
+ table data was in a different order than the feature data
+ structure, which resulted in a wild index being used in
+ feature_bool. The feature_bool function didn't check it's
+ index before indexing the features array resulting in
+ a core dump on /oper.
2003-01-10 Thomas Helvey <[EMAIL PROTECTED]>
* include/client.h, include/res.h, include/s_bsd.h,
ircd/ircd.c, ircd/list.c ircd/m_connect.c, ircd/res_adns.c,
Index: ircu2.10/ircd/client.c
diff -u ircu2.10/ircd/client.c:1.20 ircu2.10/ircd/client.c:1.21
--- ircu2.10/ircd/client.c:1.20 Tue Jan 7 02:06:42 2003
+++ ircu2.10/ircd/client.c Sat Jan 11 03:24:21 2003
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: client.c,v 1.20 2003/01/07 10:06:42 a1kmm Exp $
+ * $Id: client.c,v 1.21 2003/01/11 11:24:21 bleepster Exp $
*/
#include "config.h"
@@ -104,6 +104,7 @@
static struct
{
enum Priv priv;
+ enum Feature feat;
enum
{
FEATFLAG_DISABLES_PRIV,
@@ -112,7 +113,6 @@
FEATFLAG_LOCAL_OPERS,
FEATFLAG_ALL_OPERS
} flag;
- enum Feature feat;
} feattab[] =
{
{ PRIV_WHOX, FEAT_LAST_F, FEATFLAG_ALL_OPERS },
@@ -201,7 +201,7 @@
{
if (PrivHas(&oper->privs_dirty, feattab[i].priv))
continue;
- if (feattab[i].feat != FEAT_LAST_F && !feature_bool(feattab[i].priv))
+ if (feattab[i].feat != FEAT_LAST_F && !feature_bool(feattab[i].feat))
continue;
switch (feattab[i].flag)
{
Index: ircu2.10/ircd/ircd_features.c
diff -u ircu2.10/ircd/ircd_features.c:1.21 ircu2.10/ircd/ircd_features.c:1.22
--- ircu2.10/ircd/ircd_features.c:1.21 Tue Jan 7 19:17:19 2003
+++ ircu2.10/ircd/ircd_features.c Sat Jan 11 03:24:22 2003
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: ircd_features.c,v 1.21 2003/01/08 03:17:19 klmitch Exp $
+ * $Id: ircd_features.c,v 1.22 2003/01/11 11:24:22 bleepster Exp $
*/
#include "config.h"
@@ -801,6 +801,9 @@
int
feature_bool(enum Feature feat)
{
+ assert(feat <= FEAT_LAST_F);
+ if (FEAT_LAST_F < feat)
+ return 0;
assert(features[feat].feat == feat);
assert((features[feat].flags & FEAT_MASK) == FEAT_BOOL);
----------------------- End of diff -----------------------