Просмотр исходного кода

* Fixed rembot() using an already free`d pointer to check for duplicate bots connecting

svn: 1195
Bryan Drewery 22 лет назад
Родитель
Сommit
fd4f36edb8
2 измененных файлов с 4 добавлено и 1 удалено
  1. 1 0
      doc/UPDATES
  2. 3 1
      src/botnet.c

+ 1 - 0
doc/UPDATES

@@ -23,6 +23,7 @@ This is a summary of ChangeLog basically.
 * Moved config settings (bad-cookie, op-time-slack, manop, mdop, mop) to 'chanset'
 * Moved config settings (bad-cookie, op-time-slack, manop, mdop, mop) to 'chanset'
 * Renamed 'op-time-slack' to 'cookie-time-slack'
 * Renamed 'op-time-slack' to 'cookie-time-slack'
 * SIGHUP now restarts bot.
 * SIGHUP now restarts bot.
+* Fixed possible SEGFAULT on bot timeout.
 
 
 1.1.9
 1.1.9
 
 

+ 3 - 1
src/botnet.c

@@ -268,10 +268,11 @@ void partyaway(char *bot, int sock, char *msg)
 
 
 /* Remove a tandem bot from the chain list
 /* Remove a tandem bot from the chain list
  */
  */
-void rembot(const char *who)
+void rembot(const char *whoin)
 {
 {
   tand_t **ptr = &tandbot, *ptr2 = NULL;
   tand_t **ptr = &tandbot, *ptr2 = NULL;
   struct userrec *u = NULL;
   struct userrec *u = NULL;
+  char *who = strdup(whoin);
 
 
   while (*ptr) {
   while (*ptr) {
     if (!egg_strcasecmp((*ptr)->bot, who))
     if (!egg_strcasecmp((*ptr)->bot, who))
@@ -292,6 +293,7 @@ void rembot(const char *who)
   tands--;
   tands--;
 
 
   dupwait_notify(who);
   dupwait_notify(who);
+  free(who);
 }
 }
 
 
 void remparty(char *bot, int sock)
 void remparty(char *bot, int sock)