Преглед на файлове

* Fixed cosmetic/memory bug in cmd_who (tell_who), strftime does NOT NULL-terminate

svn: 1163
Bryan Drewery преди 22 години
родител
ревизия
e50ceff3f7
променени са 3 файла, в които са добавени 14 реда и са изтрити 11 реда
  1. 1 0
      doc/UPDATES
  2. 2 1
      src/cmds.c
  3. 11 10
      src/dcc.c

+ 1 - 0
doc/UPDATES

@@ -9,6 +9,7 @@ This is a summary of ChangeLog basically.
   -Moved PSCLOAK entries to misc/responses.txt
 * All dates are UTC (GMT) now.
 * cmd_newleaf was sharing the new bot incorrectly.
+* Fixed a cosmetic/memory bug in cmd_who.
 
 1.1.9
 

+ 2 - 1
src/cmds.c

@@ -120,7 +120,8 @@ static void tell_who(struct userrec *u, int idx, int chan)
 	ok = 1;
 	dprintf(idx, "Bots connected:\n");
       }
-      egg_strftime(s, 14, "%d %b %H:%M %Z", gmtime(&dcc[i].timeval));
+      egg_strftime(s, 20, "%d %b %H:%M %Z", gmtime(&dcc[i].timeval));
+      s[20] = 0;
       if (atr & USER_OWNER) {
         egg_snprintf(format, sizeof format, "  [%%.2lu]  %%s%%c%%-%us (%%s) %%s\n", 
 			    nicklen);

+ 11 - 10
src/dcc.c

@@ -201,16 +201,17 @@ static void bot_version(int idx, char *par)
     /* old numver crap */
   } else
     dcc[idx].u.bot->numver = 0;
-    dprintf(idx, "tb %s\n", conf.bot->nick);
-    l = atoi(newsplit(&par));
-    if (l != HANDLEN) {
-      putlog(LOG_BOTS, "*", "Non-matching handle lengths with %s, they use %d characters.", dcc[idx].nick, l);  
-      dprintf(idx, "error Non-matching handle length: mine %d, yours %d\n", HANDLEN, l);
-      dprintf(idx, "bye %s\n", "bad handlen");
-      killsock(dcc[idx].sock);
-      lostdcc(idx);
-      return;
-    }
+
+  dprintf(idx, "tb %s\n", conf.bot->nick);
+  l = atoi(newsplit(&par));
+  if (l != HANDLEN) {
+    putlog(LOG_BOTS, "*", "Non-matching handle lengths with %s, they use %d characters.", dcc[idx].nick, l);  
+    dprintf(idx, "error Non-matching handle length: mine %d, yours %d\n", HANDLEN, l);
+    dprintf(idx, "bye %s\n", "bad handlen");
+    killsock(dcc[idx].sock);
+    lostdcc(idx);
+    return;
+  }
   strncpyz(dcc[idx].u.bot->version, par, 120);
   newsplit(&par);	/* 'ver' */
   newsplit(&par);	/* handlen */