]> granicus.if.org Git - sudo/commitdiff
Fix off by one error introduced in *alloc changes
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 29 Mar 1999 04:31:16 +0000 (04:31 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 29 Mar 1999 04:31:16 +0000 (04:31 +0000)
parse.yacc
sudo.tab.c

index 15bf137de04b5ce4aee42f604de528681b48697d..1d815a6226c369f49f52ed4983b7a97d9b5ff5d6 100644 (file)
@@ -943,6 +943,8 @@ static void expand_match_list()
     if (++cm_list_len >= cm_list_size) {
        while ((cm_list_size += STACKINCREMENT) < cm_list_len)
            ;
+       if (cm_list == NULL)
+           cm_list_len = 0;            /* start at 0 since it is a subscript */
        cm_list = (struct command_match *)
            erealloc(cm_list, sizeof(struct command_match) * cm_list_size);
     }
index 2a5f826fbb6692bd4140db69c4deec214d55658b..0b69ccf36371c1d41925cd5665d98185c4b24566 100644 (file)
@@ -801,6 +801,8 @@ static void expand_match_list()
     if (++cm_list_len >= cm_list_size) {
        while ((cm_list_size += STACKINCREMENT) < cm_list_len)
            ;
+       if (cm_list == NULL)
+           cm_list_len = 0;            /* start at 0 since it is a subscript */
        cm_list = (struct command_match *)
            erealloc(cm_list, sizeof(struct command_match) * cm_list_size);
     }
@@ -838,7 +840,7 @@ void init_parser()
     if (printmatches == TRUE)
        expand_match_list();
 }
-#line 842 "sudo.tab.c"
+#line 844 "sudo.tab.c"
 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
 #if defined(__cplusplus) || __STDC__
 static int yygrowstack(void)
@@ -1508,7 +1510,7 @@ case 67:
                            user_matches = TRUE;
                        }
 break;
-#line 1512 "sudo.tab.c"
+#line 1514 "sudo.tab.c"
     }
     yyssp -= yym;
     yystate = *yyssp;