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

@@ -65,16 +65,16 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
p = skip_multiple_token (p, 11);
buf->utime = strtoul (p, &p, 0);
buf->stime = strtoul (p, &p, 0);
buf->cutime = strtoul (p, &p, 0);
buf->cstime = strtoul (p, &p, 0);
buf->utime = strtoull (p, &p, 0);
buf->stime = strtoull (p, &p, 0);
buf->cutime = strtoull (p, &p, 0);
buf->cstime = strtoull (p, &p, 0);
p = skip_multiple_token (p, 2);
buf->timeout = strtoul (p, &p, 0);
buf->it_real_value = strtoul (p, &p, 0);
buf->start_time = strtoul (p, &p, 0);
buf->timeout = strtoull (p, &p, 0);
buf->it_real_value = strtoull (p, &p, 0);
buf->start_time = strtoull (p, &p, 0);
buf->frequency = 100;
@@ -87,16 +87,16 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
return;
p = skip_token (buffer);
buf->utime = strtoul (p, &p, 0);
buf->stime = strtoul (p, &p, 0);
buf->utime = strtoull (p, &p, 0);
buf->stime = strtoull (p, &p, 0);
for (i = 0; i < GLIBTOP_NCPU; i++) {
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
break;
p += 6;
buf->xcpu_utime [i] = strtoul (p, &p, 0);
buf->xcpu_stime [i] = strtoul (p, &p, 0);
buf->xcpu_utime [i] = strtoull (p, &p, 0);
buf->xcpu_stime [i] = strtoull (p, &p, 0);
}
buf->flags |= _glibtop_sysdeps_proc_time_smp;