Wireshark-commits: [Wireshark-commits] rev 54849: /trunk/tools/lemon/ /trunk/tools/lemon/: lemon.c
Date: Sun, 19 Jan 2014 17:59:20 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=54849

User: jmayer
Date: 2014/01/19 05:59 PM

Log:
 Fix two coverity messages:
 
 *** CID 718534:  Dereference before null check  (REVERSE_INULL)
 /tools/lemon/lemon.c: 3425 in translate_code()
 3419                rp->rhs[i]->index,i-rp->nrhs+1);
 3420           }else{
 3421             /* No destructor defined for this term */
 3422           }
 3423         }
 3424       }
 >>>     CID 718534:  Dereference before null check  (REVERSE_INULL)
 >>>     Null-checking "rp->code" suggests that it may be null, but it has already been
 +dereferenced on all paths leading to the check.
 3425       if( rp->code ){
 3426         cp = append_str(0,0,0,0);
 3427         rp->code = Strsafe(cp?cp:"");
 3428       }
 3429     }
 3430
 
 *** CID 1156989:  Out-of-bounds read  (OVERRUN)
 /tools/lemon/lemon.c: 3139 in tplt_xfer()
 3133       int i, iStart;
 3134       char line[LINESIZE];
 3135       while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){
 3136         (*lineno)++;
 3137         iStart = 0;
 3138         if( name ){
 >>>     CID 1156989:  Out-of-bounds read  (OVERRUN)
 >>>     Overrunning array "line" of 1000 bytes at byte offset 1000 using index "i"
 +(which evaluates to 1000).
 3139           for(i=0; line[i] && i<LINESIZE; i++){
 3140             if( line[i]=='P' && i<(LINESIZE-5) && strncmp(&line[i],"Parse",5)==0
 3141               && (i==0 || !safe_isalpha(line[i-1]))
 3142             ){
 3143               if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]);
 3144               fprintf(out,"%s",name);

Directory: /trunk/tools/lemon/
  Changes    Path          Action
  +3 -5      lemon.c       Modified