Răsfoiți Sursa

* Use sizeof() for chan name size

Bryan Drewery 16 ani în urmă
părinte
comite
a395e50a9b
5 a modificat fișierele cu 7 adăugiri și 7 ștergeri
  1. 3 3
      src/auth.c
  2. 1 1
      src/cmds.c
  3. 1 1
      src/mod/channels.mod/tclchan.c
  4. 1 1
      src/mod/irc.mod/chan.c
  5. 1 1
      src/mod/irc.mod/irc.c

+ 3 - 3
src/auth.c

@@ -186,7 +186,7 @@ sdprintf(STR("GETIDX: auth: %s, idx: %d"), nick, idx);
     else {
       sdprintf(STR("FIRST FOUND: %d"), idx);
       strlcpy(dcc[idx].simulbot, chname ? chname : nick, sizeof(dcc[idx].simulbot));
-      strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", 81);
+      strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", sizeof(dcc[idx].u.chat->con_chan));
       return 1;
     }
   }
@@ -201,7 +201,7 @@ sdprintf(STR("GETIDX: auth: %s, idx: %d"), nick, idx);
       dcc[i].simultime = now;
       idx = i;
       strlcpy(dcc[idx].simulbot, chname ? chname : nick, sizeof(dcc[idx].simulbot));
-      strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", 81);
+      strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", sizeof(dcc[idx].u.chat->con_chan));
 
       return 1;
     }
@@ -218,7 +218,7 @@ sdprintf(STR("GETIDX: auth: %s, idx: %d"), nick, idx);
     dcc[idx].status = STAT_COLOR;
     dcc[idx].u.chat->con_flags = 0;
     strlcpy(dcc[idx].simulbot, chname ? chname : nick, sizeof(dcc[idx].simulbot));
-    strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", 81);
+    strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", sizeof(dcc[idx].u.chat->con_chan));
     dcc[idx].u.chat->strip_flags = STRIP_ALL;
     strlcpy(dcc[idx].nick, handle, sizeof(dcc[idx].nick));
     strlcpy(dcc[idx].host, host, sizeof(dcc[idx].host));

+ 1 - 1
src/cmds.c

@@ -1053,7 +1053,7 @@ static void cmd_console(int idx, char *par)
       return;
     }
 
-    strlcpy(dcc[dest].u.chat->con_chan, nick, 81);
+    strlcpy(dcc[dest].u.chat->con_chan, nick, sizeof(dcc[dest].u.chat->con_chan));
     nick[0] = 0;
     if ((dest == idx) && !glob_master(fr) && !chan_master(fr))
       /* Consoling to another channel for self */

+ 1 - 1
src/mod/channels.mod/tclchan.c

@@ -1009,7 +1009,7 @@ int channel_add(char *result, const char *newname, char *options, bool isdefault
      * any code later on. chan->name gets updated with the channel name as
      * the server knows it, when we join the channel. <cybah>
      */
-    strlcpy(chan->dname, newname, 81);
+    strlcpy(chan->dname, newname, sizeof(chan->dname));
 
     /* Initialize chan->channel info */
     if (isdefault) {

+ 1 - 1
src/mod/irc.mod/chan.c

@@ -2635,7 +2635,7 @@ static int gotjoin(char *from, char *chname)
 	  /* It was me joining! Need to update the channel record with the
 	   * unique name for the channel (as the server see's it). <cybah>
 	   */
-	  strlcpy(chan->name, chname, 81);
+	  strlcpy(chan->name, chname, sizeof(chan->name));
 	  chan->ircnet_status &= ~CHAN_JUPED;
 
           /* ... and log us joining. Using chan->dname for the channel is

+ 1 - 1
src/mod/irc.mod/irc.c

@@ -1309,7 +1309,7 @@ reset_chan_info(struct chanset_t *chan)
   if (!chan) return;
 
   if (!chan->name[0])
-    strlcpy(chan->name, chan->dname, 81);
+    strlcpy(chan->name, chan->dname, sizeof(chan->name));
 
   /* Don't reset the channel if we're already resetting it */
   if (!shouldjoin(chan)) {