Apply patch from Benoît Dejean <bnet@ifrance.com> to fix overflow issues

2003-12-23  Bastien Nocera  <hadess@hadess.net>

	* cpu.c: (glibtop_get_cpu_s):
	* glibtop_server.h:
	* loadavg.c: (glibtop_get_loadavg_s):
	* mem.c: (glibtop_get_mem_s):
	* netload.c: (glibtop_get_netload_s):
	* prockernel.c: (glibtop_get_proc_kernel_s):
	* procmem.c: (glibtop_get_proc_mem_s):
	* procsegment.c: (glibtop_get_proc_segment_s):
	* procsignal.c: (glibtop_get_proc_signal_s):
	* proctime.c: (glibtop_get_proc_time_s):
	* procuid.c: (glibtop_get_proc_uid_s):
	* swap.c: (glibtop_get_swap_s): Apply patch from Benoît Dejean
	<bnet@ifrance.com> to fix overflow issues using strtol
	(Closes: #129881)
This commit is contained in:
Bastien Nocera
2003-12-23 10:44:33 +00:00
committed by Bastien Nocera
parent 291d63f2b9
commit 79fdd6cd3b
13 changed files with 100 additions and 83 deletions

View File

@@ -75,10 +75,10 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
p = skip_token (buffer); /* "cpu" */
buf->user = strtoul (p, &p, 0);
buf->nice = strtoul (p, &p, 0);
buf->sys = strtoul (p, &p, 0);
buf->idle = strtoul (p, &p, 0);
buf->user = strtoull (p, &p, 0);
buf->nice = strtoull (p, &p, 0);
buf->sys = strtoull (p, &p, 0);
buf->idle = strtoull (p, &p, 0);
total = buf->user;
total += buf->nice;
@@ -94,10 +94,10 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
break;
p += 6;
buf->xcpu_user [i] = strtoul (p, &p, 0);
buf->xcpu_nice [i] = strtoul (p, &p, 0);
buf->xcpu_sys [i] = strtoul (p, &p, 0);
buf->xcpu_idle [i] = strtoul (p, &p, 0);
buf->xcpu_user [i] = strtoull (p, &p, 0);
buf->xcpu_nice [i] = strtoull (p, &p, 0);
buf->xcpu_sys [i] = strtoull (p, &p, 0);
buf->xcpu_idle [i] = strtoull (p, &p, 0);
total = buf->xcpu_user [i];
total += buf->xcpu_nice [i];