Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at lemon.c:2407

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

parseonetoken

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tools/lemon/lemon.c)expand/collapse
Show more  
 2029  static void parseonetoken(struct pstate *psp)
 2030  {
 2031    char *x;
 2032    x = Strsafe(psp->tokenstart);     /* Save the token permanently */
 2033  #if 0 
 2034    printf("%s:%d: Token=[%s] state=%d\n",psp->filename,psp->tokenlineno,
 2035      x,psp->state);
 2036  #endif
 2037    switch( psp->state ){
 2038      case INITIALIZE:
 2039        psp->prevrule = 0;
 2040        psp->preccounter = 0;
 2041        psp->firstrule = psp->lastrule = 0;
 2042        psp->gp->nrule = 0;
 2043        /* Fall thru to next case */
 2044      case WAITING_FOR_DECL_OR_RULE:
 2045        if( x[0]=='%' ){
 2046          psp->state = WAITING_FOR_DECL_KEYWORD;
 2047        }else if( safe_islower(x[0]) ){
 2048
2364
Show [ Lines 2048 to 2364 omitted. ]
 2365          }else{
 2366            sp->prec = psp->preccounter;
 2367            sp->assoc = psp->declassoc;
 2368          }
 2369        }else{
 2370          ErrorMsg(psp->filename,psp->tokenlineno,
 2371            "Can't assign a precedence to \"%s\".",x);
 2372          psp->errorcnt++;
 2373        }
 2374        break;
 2375      case WAITING_FOR_DECL_ARG:
 2376        if( (x[0]=='{' || x[0]=='\"' || safe_isalnum(x[0])) ){
 2377          char *zOld, *zNew, *zBuf, *z;
 2378          int nOld, n, nLine, nNew, nBack;
 2379                  int addLineMacro;
 2380          char zLine[50];
 2381          zNew = x;
 2382          if( zNew[0]=='"' || zNew[0]=='{' ) zNew++;
 2383          nNew = (int) strlen(zNew);
 2384          if( *psp->declargslot ){
 2385            zOld = *psp->declargslot;
 2386          }else{
 2387            zOld = "";
 2388          }
 2389          nOld = (int) strlen(zOld);
 2390          n = nOld + nNew + 20;
 2391          addLineMacro = psp->insertLineMacro &&
 2392                          (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0);
 2393          if( addLineMacro ){
 2394             for(z=psp->filename, nBack=0; *z; z++){
 2395              if( *z=='\\' ) nBack++;
 2396            }
 2397            sprintf(zLine, "#line %d ", psp->tokenlineno);
 2398            nLine = (int) strlen(zLine);
 2399            n += nLine + (int) strlen(psp->filename) + nBack;
 2400          }
 2401          *psp->declargslot = zBuf = realloc(*psp->declargslot, n);
 2402          zBuf += nOld;
 2403          if( addLineMacro ){
 2404            if( nOld && zBuf[-1]!='\n' ){
 2405              *(zBuf++) = '\n';
 2406            }
 2407            memcpy(zBuf, zLine, nLine);
Show more  




Change Warning 894.30277 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: