1
0
Эх сурвалжийг харах

Merge branch 'format-string'

* format-string:
  * Fix several format string warnings
Bryan Drewery 17 жил өмнө
parent
commit
3c2ff5638e

+ 1 - 3
src/dcc.c

@@ -193,12 +193,10 @@ send_timesync(int idx)
   if (idx >= 0)
     dprintf(idx, "ts %li\n", (long)(timesync + now));
   else {
-    char s[15] = "";
 
-    simple_snprintf(s, sizeof(s), "ts %li\n", (long)(timesync + now));
     for (int i = 0; i < dcc_total; i++) {
       if (dcc[i].type && (dcc[i].type == &DCC_BOT) && (bot_aggressive_to(dcc[i].user))) {
-        dprintf(i, s);
+        dprintf(i, "ts %li\n", (long)(timesync + now));
       }
     }
   }

+ 1 - 1
src/misc.c

@@ -639,7 +639,7 @@ readsocks(const char *fname)
     else if (!strcmp(type, STR("+serv_cache"))) {
       if (!cached_005 && strstr(bufp, "005"))
         cached_005 = 1;
-      dprintf(DP_CACHE, bufp);
+      dprintf(DP_CACHE, "%s", bufp);
     }
 
     if (enc)

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

@@ -59,7 +59,7 @@ static void resolv_member_callback(int id, void *client_data, const char *host,
           if (pe) {
             char user[15] = "";
 
-            simple_snprintf(user, pe - ps + 1, m->userhost);
+            strlcpy(user, m->userhost, pe - ps + 1);
             simple_snprintf(m->userip, sizeof(m->userip), "%s@%s", user, ips[0]);
             if (!m->user) {
               simple_snprintf(s, sizeof(s), "%s!%s", m->nick, m->userip);

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

@@ -625,9 +625,7 @@ static int msgc_help(Auth *a, char *chname, char *par)
       strlcat(outbuf, entry->mask, sizeof(outbuf));
     }
 
-  strlcat(outbuf, "\n", sizeof(outbuf));
-
-  reply(a->nick, NULL, outbuf);
+  reply(a->nick, NULL, "%s\n", outbuf);
   return BIND_RET_BREAK;
 }
 

+ 1 - 1
src/shell.c

@@ -527,7 +527,7 @@ void detected(int code, const char *msg)
   case DET_IGNORE:
     break;
   case DET_WARN:
-    putlog(LOG_WARN, "*", msg);
+    putlog(LOG_WARN, "*", "%s", msg);
     break;
   case DET_REJECT:
     do_fork();