Commit 85c3b529f8ad4d65ba86b982ef050212ae7dd976

Authored by Eric Paris
Committed by James Morris
1 parent 821d35a560

SELinux: header generation may hit infinite loop

If a permission name is long enough the selinux class definition generation
tool will go into a infinite loop.  This is because it's macro max() is
fooled into thinking it is dealing with unsigned numbers.  This patch makes
sure the macro always uses signed number so 1 > -1.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

scripts/selinux/genheaders/genheaders.c
... ... @@ -13,7 +13,7 @@
13 13 #include "classmap.h"
14 14 #include "initial_sid_to_string.h"
15 15  
16   -#define max(x, y) ((x > y) ? x : y)
  16 +#define max(x, y) (((int)(x) > (int)(y)) ? x : y)
17 17  
18 18 const char *progname;
19 19