From 90e6bf318022a93d0af2f41230004906e47e38b8 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 22 Nov 2015 09:19:12 -0700 Subject: [PATCH] Use yy_size_t for digest_len since newer flex uses yy_size_t for yyleng. Old flex uses int for yyleng so we need to use a cast to avoid a sign compare warning. --- plugins/sudoers/toke.c | 8 ++++---- plugins/sudoers/toke.l | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c index 9a1acc864..4cd0393e4 100644 --- a/plugins/sudoers/toke.c +++ b/plugins/sudoers/toke.c @@ -2014,7 +2014,7 @@ gid_t sudoers_gid = SUDOERS_GID; static bool continued, sawspace; static int prev_state; -static int digest_len; +static yy_size_t digest_len; static bool push_include_int(char *, bool); static bool pop_include(void); @@ -2476,7 +2476,7 @@ YY_RULE_SETUP #line 256 "toke.l" { /* Only return DIGEST if the length is correct. */ - if (sudoersleng == digest_len * 2) { + if ((yy_size_t)sudoersleng == digest_len * 2) { if (!fill(sudoerstext, sudoersleng)) yyterminate(); BEGIN INITIAL; @@ -2492,7 +2492,7 @@ YY_RULE_SETUP #line 269 "toke.l" { /* Only return DIGEST if the length is correct. */ - int len; + yy_size_t len; if (sudoerstext[sudoersleng - 1] == '=') { /* use padding */ len = 4 * ((digest_len + 2) / 3); @@ -2500,7 +2500,7 @@ YY_RULE_SETUP /* no padding */ len = (4 * digest_len + 2) / 3; } - if (sudoersleng == len) { + if ((yy_size_t)sudoersleng == len) { if (!fill(sudoerstext, sudoersleng)) yyterminate(); BEGIN INITIAL; diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index 000660a86..ca910f245 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -74,7 +74,7 @@ gid_t sudoers_gid = SUDOERS_GID; static bool continued, sawspace; static int prev_state; -static int digest_len; +static yy_size_t digest_len; static bool push_include_int(char *, bool); static bool pop_include(void); @@ -255,7 +255,7 @@ DEFVAR [a-z_]+ [[:xdigit:]]+ { /* Only return DIGEST if the length is correct. */ - if (sudoersleng == digest_len * 2) { + if ((yy_size_t)sudoersleng == digest_len * 2) { if (!fill(sudoerstext, sudoersleng)) yyterminate(); BEGIN INITIAL; @@ -268,7 +268,7 @@ DEFVAR [a-z_]+ [A-Za-z0-9\+/=]+ { /* Only return DIGEST if the length is correct. */ - int len; + yy_size_t len; if (sudoerstext[sudoersleng - 1] == '=') { /* use padding */ len = 4 * ((digest_len + 2) / 3); @@ -276,7 +276,7 @@ DEFVAR [a-z_]+ /* no padding */ len = (4 * digest_len + 2) / 3; } - if (sudoersleng == len) { + if ((yy_size_t)sudoersleng == len) { if (!fill(sudoerstext, sudoersleng)) yyterminate(); BEGIN INITIAL; -- 2.40.0