Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at lemon.c:1522

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

main

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tools/lemon/lemon.c)expand/collapse
Show more  
 1444  int main(int argc _U_, char **argv)
 1445  {
 1446    static int version = 0;
 1447    static int rpflag = 0;
 1448    static int basisflag = 0;
 1449    static int compress = 0;
 1450    static int quiet = 0;
 1451    static int statistics = 0;
 1452    static int mhflag = 0;
 1453    static char *outdirname = NULL;
 1454    static char *templatename = NULL;
 1455    static struct s_options options[] = {
 1456      {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."},
 1457      {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."},
 1458      {OPT_STR,  "d", (char*)&outdirname, "Output directory name."},
 1459      {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."},
 1460      {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."},
 1461      {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"},
 1462      {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."},
 1463      {OPT_FLAG, "s", (char*)&statistics,
 1464                                     "Print parser stats to standard output."},
 1465      {OPT_STR,  "t", (char*)&templatename, "Template file to use."},
 1466      {OPT_FLAG, "x", (char*)&version, "Print the version number."},
 1467      {OPT_FLAG,0,0,0}
 1468    };
 1469    int i;
 1470    struct lemon lem;
 1471   
 1472    optinit(argv,options,stderr);
 1473    if( version ){
 1474       printf("Lemon version 1.0\n"
 1475         "Copyright 1991-1997 by D. Richard Hipp\n"
 1476         "Freely distributable under the GNU Public License.\n"
 1477       );
 1478       exit(0);
 1479    }
 1480[+]   if( optnargs()!=1 ){
 1481      fprintf(stderr,"Exactly one filename argument is required.\n");
 1482      exit(1);
 1483    }
 1484    memset(&lem, 0, sizeof(lem));
 1485    lem.errorcnt = 0;
 1486   
 1487    /* Initialize the machine */
 1488    Strsafe_init();
 1489[+]   Symbol_init();
 1490    State_init();
 1491    lem.argv0 = argv[0];
 1492    lem.filename = get_optarg(0);
 1493    lem.basisflag = basisflag;
 1494    Symbol_new("$");
 1495    lem.errsym = Symbol_new("error");
 1496    /*
 1497    **  Resetting useCnt in errsym seems to disable some error checking we  
 1498    **  need to validate the filter syntax.  So we remove this resetting for now.
 1499    **
 1500    **  lem.errsym->useCnt = 0;
 1501    */
 1502    lem.outdirname = outdirname;
 1503    lem.templatename = templatename;
 1504    lem.basename = make_basename(lem.filename);
 1505   
 1506    /* Parse the input file */
 1507[+]   Parse(&lem);
 1508    if( lem.errorcnt ) exit(lem.errorcnt);
 1509    if( lem.nrule==0 ){
 1510      fprintf(stderr,"Empty grammar.\n");
 1511      exit(1);
 1512    }
 1513   
 1514    /* Count and index the symbols of the grammar */
 1515    lem.nsymbol = Symbol_count();
 1516    Symbol_new("{default}");
 1517[+]   lem.symbols = Symbol_arrayof();
 1518    for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i;
 1519    qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*),
 1520          Symbolcmpp);
 1521    for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i;
 1522    for(i=1; safe_isupper(lem.symbols[i]->name[0]); i++);
Show more  




Change Warning 932.30683 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: