From 2033be83c619cd5881f36499c678b679dc62e2c8 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 3 Feb 2015 15:58:09 -0700 Subject: [PATCH] Regen with yacc skeleton that the clang analyzer doesn't complain about. --- plugins/sudoers/getdate.c | 68 ++++++++++++++++++++++++++++++++++++--- plugins/sudoers/gram.c | 68 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 126 insertions(+), 10 deletions(-) diff --git a/plugins/sudoers/getdate.c b/plugins/sudoers/getdate.c index e10ad2a9b..e0e521caa 100644 --- a/plugins/sudoers/getdate.c +++ b/plugins/sudoers/getdate.c @@ -143,7 +143,11 @@ typedef union { #define tZONE 268 #define tDST 269 #define YYERRCODE 256 +#if defined(__cplusplus) || defined(__STDC__) const short yylhs[] = +#else +short yylhs[] = +#endif { -1, 0, 0, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 6, 6, 6, 5, @@ -151,7 +155,11 @@ const short yylhs[] = 9, 9, 9, 9, 9, 9, 9, 9, 8, 1, 1, }; +#if defined(__cplusplus) || defined(__STDC__) const short yylen[] = +#else +short yylen[] = +#endif { 2, 0, 2, 1, 1, 1, 1, 1, 1, 2, 4, 4, 6, 6, 1, 1, 2, 1, 2, 2, 3, @@ -159,7 +167,11 @@ const short yylen[] = 2, 1, 2, 2, 1, 2, 2, 1, 1, 0, 1, }; +#if defined(__cplusplus) || defined(__STDC__) const short yydefred[] = +#else +short yydefred[] = +#endif { 1, 0, 0, 15, 32, 0, 38, 35, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 0, 18, 0, @@ -167,30 +179,50 @@ const short yydefred[] = 0, 0, 16, 28, 0, 23, 27, 22, 0, 0, 25, 41, 11, 0, 10, 0, 0, 21, 13, 12, }; +#if defined(__cplusplus) || defined(__STDC__) const short yydgoto[] = +#else +short yydgoto[] = +#endif { 1, 45, 11, 12, 13, 14, 15, 16, 17, 18, }; +#if defined(__cplusplus) || defined(__STDC__) const short yysindex[] = +#else +short yysindex[] = +#endif { 0, -249, -38, 0, 0, -260, 0, 0, -240, -47, -248, 0, 0, 0, 0, 0, 0, 0, -237, 0, -18, 0, 0, 0, 0, 0, 0, -262, 0, 0, -239, -238, -236, 0, 0, -235, 0, 0, 0, -56, -19, 0, 0, 0, -234, 0, -232, -258, 0, 0, 0,}; +#if defined(__cplusplus) || defined(__STDC__) const short yyrindex[] = +#else +short yyrindex[] = +#endif { 0, 0, 1, 0, 0, 0, 0, 0, 0, 69, 12, 0, 0, 0, 0, 0, 0, 0, 23, 0, 34, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 45, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0,}; +#if defined(__cplusplus) || defined(__STDC__) const short yygindex[] = +#else +short yygindex[] = +#endif { 0, -17, 0, 0, 0, 0, 0, 0, 0, 0, }; #define YYTABLESIZE 337 +#if defined(__cplusplus) || defined(__STDC__) const short yytable[] = +#else +short yytable[] = +#endif { 32, 17, 44, 42, 36, 37, 19, 20, 49, 2, 3, 31, 14, 4, 5, 6, 7, 8, 9, 10, 34, @@ -227,7 +259,11 @@ const short yytable[] = 40, 0, 40, 40, 26, 26, 0, 39, 26, 26, 26, 26, 0, 0, 26, 39, 39, }; +#if defined(__cplusplus) || defined(__STDC__) const short yycheck[] = +#else +short yycheck[] = +#endif { 47, 0, 58, 261, 266, 267, 44, 267, 266, 258, 259, 58, 0, 262, 263, 264, 265, 266, 267, 268, 257, @@ -270,7 +306,11 @@ const short yycheck[] = #endif #define YYMAXTOKEN 269 #if YYDEBUG +#if defined(__cplusplus) || defined(__STDC__) const char * const yyname[] = +#else +char *yyname[] = +#endif { "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,"','",0,0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0, @@ -282,7 +322,11 @@ const char * const yyname[] = "tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT", "tSNUMBER","tUNUMBER","tZONE","tDST", }; +#if defined(__cplusplus) || defined(__STDC__) const char * const yyrule[] = +#else +char *yyrule[] = +#endif {"$accept : spec", "spec :", "spec : spec item", @@ -976,7 +1020,11 @@ main(int argc, char *argv[]) #endif /* TEST */ #line 969 "getdate.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ +#if defined(__cplusplus) || defined(__STDC__) static int yygrowstack(void) +#else +static int yygrowstack() +#endif { unsigned int newsize; long sslen; @@ -989,22 +1037,24 @@ static int yygrowstack(void) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; - sslen = yyssp - yyss; #ifdef SIZE_MAX #define YY_SIZE_MAX SIZE_MAX #else +#ifdef __STDC__ #define YY_SIZE_MAX 0xffffffffU +#else +#define YY_SIZE_MAX (unsigned int)0xffffffff #endif - if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) +#endif + if (YY_SIZE_MAX / newsize < sizeof *newss) goto bail; + 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 + sslen; - if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) - goto bail; newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */ if (newvs == NULL) @@ -1030,11 +1080,19 @@ bail: #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int +#if defined(__cplusplus) || defined(__STDC__) yyparse(void) +#else +yyparse() +#endif { int yym, yyn, yystate; #if YYDEBUG +#if defined(__cplusplus) || defined(__STDC__) const char *yys; +#else /* !(defined(__cplusplus) || defined(__STDC__)) */ + char *yys; +#endif /* !(defined(__cplusplus) || defined(__STDC__)) */ if ((yys = getenv("YYDEBUG"))) { @@ -1458,7 +1516,7 @@ case 41: yyval.Meridian = yyvsp[0].Meridian; } break; -#line 1453 "getdate.c" +#line 1467 "getdate.c" } yyssp -= yym; yystate = *yyssp; diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index df26a1290..69e468a28 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -173,7 +173,11 @@ typedef union { #define SHA384_TOK 294 #define SHA512_TOK 295 #define YYERRCODE 256 +#if defined(__cplusplus) || defined(__STDC__) const short sudoerslhs[] = +#else +short sudoerslhs[] = +#endif { -1, 0, 0, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 4, 4, 3, 3, @@ -188,7 +192,11 @@ const short sudoerslhs[] = 13, 13, 13, 13, 17, 17, 15, 15, 16, 16, 16, }; +#if defined(__cplusplus) || defined(__STDC__) const short sudoerslen[] = +#else +short sudoerslen[] = +#endif { 2, 0, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 1, 3, 1, 2, @@ -203,7 +211,11 @@ const short sudoerslen[] = 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 1, }; +#if defined(__cplusplus) || defined(__STDC__) const short sudoersdefred[] = +#else +short sudoersdefred[] = +#endif { 0, 0, 100, 102, 103, 104, 0, 0, 0, 0, 0, 101, 5, 0, 0, 0, 0, 0, 0, 96, 98, @@ -224,14 +236,22 @@ const short sudoersdefred[] = 106, 52, 53, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 36, }; +#if defined(__cplusplus) || defined(__STDC__) const short sudoersdgoto[] = +#else +short sudoersdgoto[] = +#endif { 18, 119, 120, 27, 28, 48, 49, 50, 51, 35, 67, 37, 19, 20, 21, 136, 137, 138, 121, 125, 68, 69, 158, 129, 130, 131, 146, 147, 148, 52, 22, 23, 60, 54, 57, 63, 55, 58, 64, 61, }; +#if defined(__cplusplus) || defined(__STDC__) const short sudoerssindex[] = +#else +short sudoerssindex[] = +#endif { -33, -277, 0, 0, 0, 0, -13, 75, 105, 105, -15, 0, 0, -246, -241, -217, -210, -226, 0, 0, 0, @@ -251,7 +271,11 @@ const short sudoerssindex[] = 0, 135, 54, 0, 0, -159, -158, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; +#if defined(__cplusplus) || defined(__STDC__) const short sudoersrindex[] = +#else +short sudoersrindex[] = +#endif { 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -271,7 +295,11 @@ const short sudoersrindex[] = 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; +#if defined(__cplusplus) || defined(__STDC__) const short sudoersgindex[] = +#else +short sudoersgindex[] = +#endif { 0, -10, 0, 47, 17, 80, 65, -84, 27, 92, -4, 48, 62, 112, 2, -25, 10, -9, 0, 0, 33, @@ -279,7 +307,11 @@ const short sudoersgindex[] = 111, 0, 0, 0, 0, 50, 51, 52, 53, }; #define YYTABLESIZE 970 +#if defined(__cplusplus) || defined(__STDC__) const short sudoerstable[] = +#else +short sudoerstable[] = +#endif { 17, 19, 109, 36, 24, 26, 40, 41, 127, 128, 38, 39, 53, 43, 26, 74, 77, 56, 43, 26, 26, @@ -379,7 +411,11 @@ const short sudoerstable[] = 56, 56, 56, 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 56, 56, 56, }; +#if defined(__cplusplus) || defined(__STDC__) const short sudoerscheck[] = +#else +short sudoerscheck[] = +#endif { 33, 0, 86, 7, 281, 33, 257, 258, 287, 288, 8, 9, 258, 33, 33, 259, 44, 258, 33, 33, 33, @@ -485,7 +521,11 @@ const short sudoerscheck[] = #endif #define YYMAXTOKEN 295 #if YYDEBUG +#if defined(__cplusplus) || defined(__STDC__) const char * const sudoersname[] = +#else +char *sudoersname[] = +#endif { "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, "'!'",0,0,0,0,0,0,"'('","')'",0,"'+'","','","'-'",0,0,0,0,0,0,0,0,0,0,0,0,"':'", @@ -501,7 +541,11 @@ const char * const sudoersname[] = "CMNDALIAS","USERALIAS","RUNASALIAS","ERROR","TYPE","ROLE","PRIVS","LIMITPRIVS", "MYSELF","SHA224_TOK","SHA256_TOK","SHA384_TOK","SHA512_TOK", }; +#if defined(__cplusplus) || defined(__STDC__) const char * const sudoersrule[] = +#else +char *sudoersrule[] = +#endif {"$accept : file", "file :", "file : line", @@ -902,7 +946,11 @@ init_parser(const char *path, bool quiet) } #line 895 "gram.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ +#if defined(__cplusplus) || defined(__STDC__) static int yygrowstack(void) +#else +static int yygrowstack() +#endif { unsigned int newsize; long sslen; @@ -915,22 +963,24 @@ static int yygrowstack(void) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; - sslen = yyssp - yyss; #ifdef SIZE_MAX #define YY_SIZE_MAX SIZE_MAX #else +#ifdef __STDC__ #define YY_SIZE_MAX 0xffffffffU +#else +#define YY_SIZE_MAX (unsigned int)0xffffffff #endif - if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) +#endif + if (YY_SIZE_MAX / newsize < sizeof *newss) goto bail; + 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 + sslen; - if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) - goto bail; newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */ if (newvs == NULL) @@ -956,11 +1006,19 @@ bail: #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int +#if defined(__cplusplus) || defined(__STDC__) yyparse(void) +#else +yyparse() +#endif { int yym, yyn, yystate; #if YYDEBUG +#if defined(__cplusplus) || defined(__STDC__) const char *yys; +#else /* !(defined(__cplusplus) || defined(__STDC__)) */ + char *yys; +#endif /* !(defined(__cplusplus) || defined(__STDC__)) */ if ((yys = getenv("YYDEBUG"))) { @@ -1781,7 +1839,7 @@ case 111: yyval.member = new_member(yyvsp[0].string, WORD); } break; -#line 1776 "gram.c" +#line 1790 "gram.c" } yyssp -= yym; yystate = *yyssp; -- 2.40.0