summaryrefslogtreecommitdiff
path: root/harmony/busybox/top-buffer-overflow.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-02-27 14:34:02 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-02-27 14:34:02 -0600
commit7553795ec2d735c01dbdde129a65b7f45d5aa999 (patch)
treeb3970009a8246b0c17a105fe6b10c8077fc2b763 /harmony/busybox/top-buffer-overflow.patch
parente2b01859c88d221992403d1293d42da33002be4d (diff)
downloadpackages-7553795ec2d735c01dbdde129a65b7f45d5aa999.tar.gz
packages-7553795ec2d735c01dbdde129a65b7f45d5aa999.tar.bz2
packages-7553795ec2d735c01dbdde129a65b7f45d5aa999.tar.xz
packages-7553795ec2d735c01dbdde129a65b7f45d5aa999.zip
Add harmony/ repo for packages still being discussed
See https://wiki.adelielinux.org/wiki/Project:Harmony
Diffstat (limited to 'harmony/busybox/top-buffer-overflow.patch')
-rw-r--r--harmony/busybox/top-buffer-overflow.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/harmony/busybox/top-buffer-overflow.patch b/harmony/busybox/top-buffer-overflow.patch
new file mode 100644
index 000000000..14b23c648
--- /dev/null
+++ b/harmony/busybox/top-buffer-overflow.patch
@@ -0,0 +1,20 @@
+--- busybox-1.27.0.orig/procps/top.c
++++ busybox-1.27.0/procps/top.c
+@@ -694,10 +694,14 @@
+ CALC_STAT(pcpu, (s->pcpu*pcpu_scale + pcpu_half) >> pcpu_shift);
+ #endif
+
+- if (s->vsz >= 100000)
+- sprintf(vsz_str_buf, "%6ldm", s->vsz/1024);
++ if ((s->vsz / (1024 * 1024)) >= 100000)
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%6ldt", s->vsz/(1024 * 1024 * 1024));
++ else if ((s->vsz / 1024) >= 100000)
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%6ldg", s->vsz/(1024 * 1024));
++ else if (s->vsz >= 100000)
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%6ldm", s->vsz/1024);
+ else
+- sprintf(vsz_str_buf, "%7lu", s->vsz);
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%7lu", s->vsz);
+ /* PID PPID USER STAT VSZ %VSZ [%CPU] COMMAND */
+ col = snprintf(line_buf, scr_width,
+ "\n" "%5u%6u %-8.8s %s%s" FMT