Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
procps
procps-v3.3.3-integer-overflow.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File procps-v3.3.3-integer-overflow.patch of Package procps
--- proc/sysinfo.c +++ proc/sysinfo.c 2012-06-04 09:45:53.448364904 +0000 @@ -676,8 +676,16 @@ nextline: if(kb_inactive==~0UL){ kb_inactive = kb_inact_dirty + kb_inact_clean + kb_inact_laundry; } - kb_swap_used = kb_swap_total - kb_swap_free; - kb_main_used = kb_main_total - kb_main_free; + if (kb_swap_total > kb_swap_free) { + kb_swap_used = kb_swap_total - kb_swap_free; + } else { + kb_swap_used = 0; + } + if (kb_main_total > kb_main_free) { + kb_main_used = kb_main_total - kb_main_free; + } else { + kb_main_used = 0; + } kb_main_cached += kb_swap_reclaimable + kb_swap_cached + kb_nfs_unstable; } --- free.c +++ free.c 2012-06-04 09:50:26.588010539 +0000 @@ -310,24 +310,44 @@ int main(int argc, char **argv) * to print the high info, even if it is zero. */ if (flags & FREE_LOHI) { + unsigned long kb_low_used; + unsigned long kb_high_used; + + if (kb_low_total > kb_low_free) + kb_low_used = kb_low_total - kb_low_free; + else + kb_low_used = 0; + + if (kb_high_total > kb_high_free) + kb_high_used = kb_high_total - kb_high_free; + else + kb_high_used = 0; + printf("%-7s", _("Low:")); printf(" %10s", scale_size(kb_low_total, flags, args)); - printf(" %10s", scale_size(kb_low_total - kb_low_free, flags, args)); + printf(" %10s", scale_size(kb_low_used, flags, args)); printf(" %10s", scale_size(kb_low_free, flags, args)); printf("\n"); printf("%-7s", _("High:")); printf(" %10s", scale_size(kb_high_total, flags, args)); - printf(" %10s", scale_size(kb_high_total - kb_high_free, flags, args)); + printf(" %10s", scale_size(kb_high_used, flags, args)); printf(" %10s", scale_size(kb_high_free, flags, args)); printf("\n"); } if (!(flags & FREE_OLDFMT)) { unsigned KLONG buffers_plus_cached = kb_main_buffers + kb_main_cached; + unsigned long kb_used_minus_bufcache; + + if (kb_main_used > buffers_plus_cached) + kb_used_minus_bufcache = kb_main_used - buffers_plus_cached; + else + kb_used_minus_bufcache = 0; + printf(_("-/+ buffers/cache:")); printf(" %10s", - scale_size(kb_main_used - buffers_plus_cached, flags, args)); + scale_size(kb_used_minus_bufcache, flags, args)); printf(" %10s", scale_size(kb_main_free + buffers_plus_cached, flags, args)); printf("\n");
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor