Text   |  XML   |  ReML   |   Visible Warnings:

Buffer Overrun  at lemon.c:3338

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

translate_code

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tools/lemon/lemon.c)expand/collapse
Show more  
 3320  PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){
 3321    char *cp, *xp;
 3322    int i;
 3323    char lhsused = 0;    /* True if the LHS element has been used */
 3324    char used[MAXRHS];   /* True for each RHS element which is used */
 3325   
 3326    for(i=0; i<rp->nrhs; i++) used[i] = 0;
 3327    lhsused = 0;
 3328   
 3329    if (!rp->code) {
 3330            rp->code = "\n";
 3331            rp->line = rp->ruleline;
 3332    }
 3333     
 3334    append_str(0,0,0,0);
 3335    for(cp=rp->code; *cp; cp++){
 3336      if( safe_isalpha(*cp) && (cp==rp->code || (!safe_isalnum(cp[-1]) && cp[-1]!='_')) ){
 3337        char saved;
 3338        for(xp= &cp[1]; safe_isalnum(*xp) || *xp=='_'; xp++);
 3339        saved = *xp;
 3340        *xp = 0;
 3341        if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){
 3342          append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0);
 3343          cp = xp;
 3344          lhsused = 1;
 3345        }else{
 3346          for(i=0; i<rp->nrhs; i++){
 3347            if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){
 3348              if( cp!=rp->code && cp[-1]=='@' ){
 3349                /* If the argument is of the form @X then substituted
 3350                ** the token number of X, not the value of X */
 3351                append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0);
 3352              }else{
 3353                struct symbol *sp = rp->rhs[i];
 3354                int dtnum;
 3355                if( sp->type==MULTITERMINAL ){
 3356                  dtnum = sp->subsym[0]->dtnum;
 3357                }else{
 3358                  dtnum = sp->dtnum;
 3359                }
 3360                append_str("yymsp[%d].minor.yy%d",0,i-rp->nrhs+1, dtnum);
 3361              }
 3362              cp = xp;
 3363              used[i] = 1;
 3364              break;
 3365            }
 3366          }
 3367        }
 3368        *xp = saved;
 3369      }
 3370      append_str(cp, 1, 0, 0);
Show more  




Change Warning 921.30234 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: