Ver Fonte

* Use sizeof() for buffer updating

Bryan Drewery há 16 anos atrás
pai
commit
12b1e3dee8
2 ficheiros alterados com 2 adições e 2 exclusões
  1. 1 1
      src/egg_timer.c
  2. 1 1
      src/net.c

+ 1 - 1
src/egg_timer.c

@@ -254,7 +254,7 @@ static bool process_timer(egg_timer_t* timer) {
 	}
 
 	if (timer->name)
-		simple_snprintf(get_buf[current_get_buf], SGRAB + 10, "Execing timer: %s", timer->name);
+		simple_snprintf(get_buf[current_get_buf], sizeof(get_buf[current_get_buf]), "Execing timer: %s", timer->name);
 	if (++current_get_buf == GET_BUFS)
 		current_get_buf = 0;
 

+ 1 - 1
src/net.c

@@ -1487,7 +1487,7 @@ bool socket_run() {
     if ((idx = findanyidx(xx)) != -1) {
       if (likely(dcc[idx].type->activity)) {
         if (buf[0])
-          strlcpy(get_buf[current_get_buf], buf, i+1);
+          strlcpy(get_buf[current_get_buf], buf, sizeof(get_buf[current_get_buf]));
 
         if (++current_get_buf == GET_BUFS)
           current_get_buf = 0;