Explorar o código

* Changed the few strncat()s to OpenBSD's strlcat()
(Need to convert all of strcat() and strcpy())


svn: 1718

Bryan Drewery %!s(int64=21) %!d(string=hai) anos
pai
achega
a2fde485dd
Modificáronse 3 ficheiros con 5 adicións e 5 borrados
  1. 2 2
      src/chanprog.c
  2. 2 2
      src/crypt.c
  3. 1 1
      src/mod/channels.mod/cmdschan.c

+ 2 - 2
src/chanprog.c

@@ -485,8 +485,8 @@ void load_internal_users()
       case 2:
 	hosts = ln;
 	if (owner[0])
-	  strncat(owner, ",", 120);
-	strncat(owner, hand, 120);
+	  strlcat(owner, ",", 120);
+	strlcat(owner, hand, 120);
 	if (!get_user_by_handle(userlist, hand)) {
 	  userlist = adduser(userlist, hand, "none", "-", USER_ADMIN | USER_OWNER | USER_MASTER | USER_OP | USER_PARTY | USER_HUBA | USER_CHUBA, 0);
 	  u = get_user_by_handle(userlist, hand);

+ 2 - 2
src/crypt.c

@@ -122,7 +122,7 @@ void encrypt_pass(char *s1, char *s2)
     s1[MAXPASSLEN] = 0;
   tmp = encrypt_string(s1, s1);
   strcpy(s2, "+");
-  strncat(s2, tmp, MAXPASSLEN);
+  strlcat(s2, tmp, MAXPASSLEN);
   s2[MAXPASSLEN] = 0;
   free(tmp);
 }
@@ -153,7 +153,7 @@ void encrypt_pass_new(char *s1, char *s2)
     s1[MAXPASSLEN] = 0;
   tmp = encrypt_string(s1, passkey);
   strcpy(s2, "+");
-  strncat(s2, tmp, MAXPASSLEN);
+  strlcat(s2, tmp, MAXPASSLEN);
   s2[MAXPASSLEN] = 0;
   free(tmp);
 }

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

@@ -515,7 +515,7 @@ static void cmd_slowjoin(int idx, char *par)
   }
   strcpy(buf, "+inactive ");
   if (par[0])
-    strncat(buf, par, sizeof(buf));
+    strlcat(buf, par, sizeof(buf));
   if (channel_add(buf2, chname, buf) == ERROR) {
     dprintf(idx, "Invalid channel or channel options.\n");
     if (buf2[0])