]> granicus.if.org Git - procps-ng/commitdiff
top: Protect macro parameters.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Fri, 18 May 2018 21:32:34 +0000 (07:32 +1000)
top/top.c

index c7cf434d16dff8d42ebc7dc0b507beca26903bd9..01978e76c955124552e743787e278aaaaf0ec64e 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5920,8 +5920,8 @@ static int window_show (WIN_t *q, int wmax) {
  /* the isBUSY macro determines if a task is 'active' --
     it returns true if some cpu was used since the last sample.
     ( actual 'running' tasks will be a subset of those selected ) */
- #define isBUSY(x)   (0 < x->pcpu)
- #define winMIN(a,b) ((a < b) ? a : b)
+ #define isBUSY(x)   (0 < (x)->pcpu)
+ #define winMIN(a,b) (((a) < (b)) ? (a) : (b))
    int i, lwin;
 
    // Display Column Headings -- and distract 'em while we sort (maybe)