AnsweredAssumed Answered

bug in  ppphdlc.c

Question asked by Martin Kozusky on Nov 25, 2015
Latest reply on Nov 25, 2015 by Daniel Chen

While checking why I cannot connect to GPRS in GPRS example - connects even without modem    I am going through source code and I found a bug in  ppphdlc.c

 

There are 3 loops with this code:

 

 if(fgetc(ppphdlc_ptr->DEVICE) == PPPHDLC_FLAG)
          {
            wait=0;           
          }

 

there is  wait--; on the next line, so it will become 0xFFFFFFFF and the loop doesn't end immediately

I would suggest to repair it like:

 

 if(fgetc(ppphdlc_ptr->DEVICE) == PPPHDLC_FLAG)
          {
            wait=0;
            continue;
          }

 

 

BTW: wouldn't it be better to do things like this (protocol parsing) with state machine?

 

PS: is this the right place to write things like this, or should I report it somewhere else so that it gets to the right people?

Outcomes