summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@courtesan.com>2013-10-30 14:27:50 -0600
committerTodd C. Miller <Todd.Miller@courtesan.com>2013-10-30 14:27:50 -0600
commit1ddd83be13c43250cbbd469e41a8e2de40264f94 (patch)
tree75c6fc738a6f5fd8620f0a40c88821f6c7d2630d
parente93121ef9f165614890e0942c5042ccc21dfd1c6 (diff)
downloadsudo-1ddd83be13c43250cbbd469e41a8e2de40264f94.tar.gz
Fix sign comparison warning.
-rw-r--r--plugins/sudoers/getdate.c21
-rw-r--r--plugins/sudoers/gram.c19
2 files changed, 25 insertions, 15 deletions
diff --git a/plugins/sudoers/getdate.c b/plugins/sudoers/getdate.c
index 9cc2d5a72..ed8db4398 100644
--- a/plugins/sudoers/getdate.c
+++ b/plugins/sudoers/getdate.c
@@ -389,7 +389,7 @@ YYSTYPE yylval;
short *yyss;
short *yysslim;
YYSTYPE *yyvs;
-int yystacksize;
+unsigned int yystacksize;
#line 326 "getdate.y"
/* Month and day table. */
@@ -1035,7 +1035,8 @@ static int yygrowstack(void)
static int yygrowstack()
#endif
{
- int newsize, i;
+ unsigned int newsize;
+ long sslen;
short *newss;
YYSTYPE *newvs;
@@ -1047,23 +1048,27 @@ static int yygrowstack()
#ifdef SIZE_MAX
#define YY_SIZE_MAX SIZE_MAX
#else
-#define YY_SIZE_MAX 0x7fffffff
+#ifdef __STDC__
+#define YY_SIZE_MAX 0xffffffffU
+#else
+#define YY_SIZE_MAX (unsigned int)0xffffffff
+#endif
#endif
- if (YY_SIZE_MAX / (unsigned int)newsize < sizeof *newss)
+ if (YY_SIZE_MAX / newsize < sizeof *newss)
goto bail;
- i = yyssp - yyss;
+ sslen = yyssp - yyss;
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
(short *)malloc(newsize * sizeof *newss); /* overflow check above */
if (newss == NULL)
goto bail;
yyss = newss;
- yyssp = newss + i;
+ yyssp = newss + sslen;
newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
(YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
if (newvs == NULL)
goto bail;
yyvs = newvs;
- yyvsp = newvs + i;
+ yyvsp = newvs + sslen;
yystacksize = newsize;
yysslim = yyss + newsize - 1;
return 0;
@@ -1519,7 +1524,7 @@ case 41:
yyval.Meridian = yyvsp[0].Meridian;
}
break;
-#line 1470 "getdate.c"
+#line 1475 "getdate.c"
}
yyssp -= yym;
yystate = *yyssp;
diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c
index cd353306a..a953e2b24 100644
--- a/plugins/sudoers/gram.c
+++ b/plugins/sudoers/gram.c
@@ -698,7 +698,7 @@ YYSTYPE yylval;
short *yyss;
short *yysslim;
YYSTYPE *yyvs;
-int yystacksize;
+unsigned int yystacksize;
#line 688 "gram.y"
void
sudoerserror(const char *s)
@@ -966,7 +966,8 @@ static int yygrowstack(void)
static int yygrowstack()
#endif
{
- int newsize, i;
+ unsigned int newsize;
+ long sslen;
short *newss;
YYSTYPE *newvs;
@@ -978,23 +979,27 @@ static int yygrowstack()
#ifdef SIZE_MAX
#define YY_SIZE_MAX SIZE_MAX
#else
-#define YY_SIZE_MAX 0x7fffffff
+#ifdef __STDC__
+#define YY_SIZE_MAX 0xffffffffU
+#else
+#define YY_SIZE_MAX (unsigned int)0xffffffff
+#endif
#endif
if (YY_SIZE_MAX / newsize < sizeof *newss)
goto bail;
- i = yyssp - yyss;
+ sslen = yyssp - yyss;
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
(short *)malloc(newsize * sizeof *newss); /* overflow check above */
if (newss == NULL)
goto bail;
yyss = newss;
- yyssp = newss + i;
+ yyssp = newss + sslen;
newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
(YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
if (newvs == NULL)
goto bail;
yyvs = newvs;
- yyvsp = newvs + i;
+ yyvsp = newvs + sslen;
yystacksize = newsize;
yysslim = yyss + newsize - 1;
return 0;
@@ -1844,7 +1849,7 @@ case 111:
yyval.member = new_member(yyvsp[0].string, WORD);
}
break;
-#line 1795 "gram.c"
+#line 1800 "gram.c"
}
yyssp -= yym;
yystate = *yyssp;