Skip to content

Commit

Permalink
SELinux: header generation may hit infinite loop
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
eparis authored and James Morris committed Nov 22, 2009
1 parent 821d35a commit 85c3b52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/selinux/genheaders/genheaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct security_class_mapping {
#include "classmap.h"
#include "initial_sid_to_string.h"

#define max(x, y) ((x > y) ? x : y)
#define max(x, y) (((int)(x) > (int)(y)) ? x : y)

const char *progname;

Expand Down

0 comments on commit 85c3b52

Please sign in to comment.