Browse Source

Merge branch 'maint'

* maint:
  Stop sharing with the bot when it is disconnected.
  Fix stupid code that would loop quite long on binary data
  lostdcc: Restore bzeroing the dcc entry
Bryan Drewery 10 năm trước cách đây
mục cha
commit
6c90af25b6
3 tập tin đã thay đổi với 8 bổ sung9 xóa
  1. 2 0
      src/dcc.cc
  2. 1 4
      src/dccutil.cc
  3. 5 5
      src/net.cc

+ 2 - 0
src/dcc.cc

@@ -461,6 +461,8 @@ free_dcc_bot_(int n, void *x)
 {
   if (dcc[n].type == &DCC_BOT) {
     unvia(n, findbot(dcc[n].nick));
+    /* Stop sharing with this bot in case rembot->laston is shared out. */
+    dcc[n].status &= ~STAT_SHARE;
     rembot(dcc[n].nick);
   }
   free(x);

+ 1 - 4
src/dccutil.cc

@@ -604,12 +604,9 @@ lostdcc(int n)
   else if (n == servidx)
     servidx = -1;
 
-//  This is also done when we new_dcc(), so don't bother for now, we set sock/type to NULL, so it won't even be 
-//  parsed by anything.
-//  bzero(&dcc[n], sizeof(struct dcc_t));
+  bzero(&dcc[n], sizeof(struct dcc_t));
 
   dcc[n].sock = -1;
-  dcc[n].type = NULL;
 
   dccn--;
 

+ 5 - 5
src/net.cc

@@ -1416,14 +1416,14 @@ void tputs(int z, const char *s, size_t len)
   static int inhere = 0;
 
   if (unlikely(!inhere)) {
+    char *tmp;
+
     inhere = 1;
 
+    tmp = strldup(s, len); /* To null-terminate */
     putlog(LOG_MISC, "*", "!!! writing to nonexistent socket: %d", z);
-    if (strlen(s)) {
-      char *tmp = strdup(s); /* To null-terminate */
-      putlog(LOG_MISC, "*", "!-> '%s'", tmp);
-      free(tmp);
-    }
+    putlog(LOG_MISC, "*", "!-> '%s'", tmp);
+    free(tmp);
 
     inhere = 0;
   }