Răsfoiți Sursa

* Remove a use of snprintf

Bryan Drewery 17 ani în urmă
părinte
comite
06a482d651
2 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 2 2
      src/chanprog.c
  2. 1 1
      src/cmds.c

+ 2 - 2
src/chanprog.c

@@ -277,13 +277,13 @@ void tell_verbose_uptime(int idx)
   total = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec;
   hr = (int) (total / 60);
   min = (int) (total - (hr * 60));
-  snprintf(s2, sizeof(s2), "CPU %02d:%02d (load avg %3.1f%%)", (int) hr, (int) min, 100.0 * ((float) total / (float) (now - online_since)));
+  egg_snprintf(s2, sizeof(s2), "CPU %02d:%02d (load avg %3.1f%%)", (int) hr, (int) min, 100.0 * ((float) total / (float) (now - online_since)));
 #else
 # if HAVE_CLOCK
   cl = (clock() / CLOCKS_PER_SEC);
   hr = (int) (cl / 60);
   min = (int) (cl - (hr * 60));
-  snprintf(s2, sizeof(s2), "CPU %02d:%02d (load avg %3.1f%%)", (int) hr, (int) min,  100.0 * ((float) cl / (float) (now - online_since)));
+  egg_snprintf(s2, sizeof(s2), "CPU %02d:%02d (load avg %3.1f%%)", (int) hr, (int) min,  100.0 * ((float) cl / (float) (now - online_since)));
 # else
   simple_snprintf(s2, sizeof(s2), "CPU ???");
 # endif

+ 1 - 1
src/cmds.c

@@ -182,7 +182,7 @@ static void tell_who(int idx, int chan)
 	else if (!dcc[i].u.chat->channel)
 	  strlcat(s, "(party) ", sizeof(s));
 	else
-	  sprintf(&s[strlen(s)], "(%5d) ", dcc[i].u.chat->channel);
+	  egg_snprintf(&s[strlen(s)], sizeof(s) - strlen(s), "(%5d) ", dcc[i].u.chat->channel);
       }
       strlcat(s, dcc[i].host, sizeof(s));
       if (atr & USER_MASTER) {