[eggheads-patches] PATCH: chptfix.patch

Peter 'Rattacresh' Backes rtc at rhrk.uni-kl.de
Thu Oct 14 17:44:56 CST 1999


chpt bound tcl proc on s could be called with chan -1...


-- Peter 'Rattacresh' Backes, rtc at rhrk.uni-kl.de

-------------- next part --------------
diff -urN eggdrop1.3.29/doc/UPDATES1.3 eggdrop1.3.29+chptfix/doc/UPDATES1.3
--- eggdrop1.3.29/doc/UPDATES1.3	Thu Oct 14 23:52:33 1999
+++ eggdrop1.3.29+chptfix/doc/UPDATES1.3	Thu Oct 14 23:56:53 1999
@@ -4,6 +4,7 @@
 
 1.3.29
 Foundby   Fixedby   What....
+          rtc       tcl chpt binding could call the proc with chan -1
           Cybah	    strncpy() being used on buffers without terminating them.
 Tothwolf  Fabian    stopped userfile parsing funcs from messing with ~ and `
           rtc       language files were being installed twice
diff -urN eggdrop1.3.29/src/botcmd.c eggdrop1.3.29+chptfix/src/botcmd.c
--- eggdrop1.3.29/src/botcmd.c	Thu Oct 14 23:52:36 1999
+++ eggdrop1.3.29+chptfix/src/botcmd.c	Thu Oct 14 23:26:36 1999
@@ -1289,7 +1289,8 @@
     touch_laston(u, TBUF, now);
   }
   if ((partyidx = getparty(bot, sock)) != -1) {
-    check_tcl_chpt(bot, nick, sock, party[partyidx].chan);
+    if (party[partyidx].chan >= 0)
+      check_tcl_chpt(bot, nick, sock, party[partyidx].chan);
     if ((b_numver(idx) >= NEAT_BOTNET) && !silent) {
       register int chan = party[partyidx].chan;
 
diff -urN eggdrop1.3.29/src/botnet.c eggdrop1.3.29+chptfix/src/botnet.c
--- eggdrop1.3.29/src/botnet.c	Thu Oct 14 23:52:36 1999
+++ eggdrop1.3.29+chptfix/src/botnet.c	Thu Oct 14 23:28:03 1999
@@ -339,7 +339,8 @@
 
   for (i = 0; i < parties; i++)
     if (!strcasecmp(party[i].bot, bot)) {
-      check_tcl_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
+      if (party[i].chan >= 0)
+        check_tcl_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
       remparty(bot, party[i].sock);
       i--;
     }
@@ -861,8 +862,10 @@
       rembot(tandbot->bot);
     while (parties) {
       parties--;
-      check_tcl_chpt(party[i].bot, party[i].nick, party[i].sock,
-		     party[i].chan);
+      /* ASSERT? */
+      if (party[i].chan >= 0) 
+        check_tcl_chpt(party[i].bot, party[i].nick, party[i].sock,
+		       party[i].chan);
     }
     strcpy(s, "killassoc &");
     Tcl_Eval(interp, s);
diff -urN eggdrop1.3.29/src/cmds.c eggdrop1.3.29+chptfix/src/cmds.c
--- eggdrop1.3.29/src/cmds.c	Thu Oct 14 23:52:36 1999
+++ eggdrop1.3.29+chptfix/src/cmds.c	Thu Oct 14 22:38:28 1999
@@ -1694,7 +1694,7 @@
     if (dcc[idx].u.chat->channel < 0) {
       dprintf(idx, "You weren't in chat anyway!\n");
       return;
-    }  else {
+    } else {
       dprintf(idx, "Leaving chat mode...\n");
       check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
 		     dcc[idx].u.chat->channel);
diff -urN eggdrop1.3.29/src/dcc.c eggdrop1.3.29+chptfix/src/dcc.c
--- eggdrop1.3.29/src/dcc.c	Thu Oct 14 23:52:36 1999
+++ eggdrop1.3.29+chptfix/src/dcc.c	Thu Oct 14 23:37:58 1999
@@ -885,8 +885,9 @@
 	v = newsplit(&buf);
 	rmspace(buf);
 	if (check_tcl_dcc(v, idx, buf)) {
-	  check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-			 dcc[idx].u.chat->channel);
+	  if (dcc[idx].u.chat->channel >= 0)
+	    check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
+			   dcc[idx].u.chat->channel);
 	  check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
 	  dprintf(idx, "*** Ja mata!\n");
 	  flush_lines(idx, dcc[idx].u.chat);
diff -urN eggdrop1.3.29/src/tclhash.c eggdrop1.3.29+chptfix/src/tclhash.c
--- eggdrop1.3.29/src/tclhash.c	Thu Oct 14 23:52:36 1999
+++ eggdrop1.3.29+chptfix/src/tclhash.c	Thu Oct 14 22:16:17 1999
@@ -882,6 +882,8 @@
 {
   char u[20], v[20];
 
+  ASSERT (chan >= 0);
+
   context;
   simple_sprintf(u, "%d", sock);
   simple_sprintf(v, "%d", chan);


More information about the Patches mailing list