Browse Source

* Port [3917] to 1.2.16 from trunk
* Add some sanity checks in for where remote cmds come from (.(bot|net)*)


svn: 3918

Bryan Drewery 17 years ago
parent
commit
eeabb1acfd
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/botcmd.c

+ 14 - 0
src/botcmd.c

@@ -151,6 +151,13 @@ void bot_remotecmd(int idx, char *par) {
   if (par[0])
     fidx = newsplit(&par);
 
+  /* Make sure the bot is valid */
+  int i = nextbot(fbot);
+  if (i != idx) {
+    fake_alert(idx, "direction", fbot, "rc");
+    return;
+  }
+
   if (!egg_strcasecmp(tbot, conf.bot->nick)) {
     gotremotecmd(tbot, fbot, fhnd, fidx, par);
   } else if (!strcmp(tbot, "*")) {
@@ -174,6 +181,13 @@ void bot_remotereply(int idx, char *par) {
   if (par[0])
     fidx = newsplit(&par);
 
+  /* Make sure the bot is valid */
+  int i = nextbot(fbot);
+  if (i != idx) {
+    fake_alert(idx, "direction", fbot, "rr");
+    return;
+  }
+
   if (!egg_strcasecmp(tbot, conf.bot->nick)) {
     gotremotereply(fbot, fhnd, fidx, par);
   } else {