summaryrefslogtreecommitdiff
path: root/src/gsmd/atcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsmd/atcmd.c')
-rw-r--r--src/gsmd/atcmd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c
index adf18e0..d8a01b6 100644
--- a/src/gsmd/atcmd.c
+++ b/src/gsmd/atcmd.c
@@ -101,6 +101,7 @@ static int llparse_byte(struct llparser *llp, char byte)
llp->state = LLPARSE_STATE_PROMPT;
else {
#ifdef STRICT
+ DEBUGP("IDLE: no \\r or > following \\r\n");
llp->state = LLPARSE_STATE_ERROR;
#else
llp->state = LLPARSE_STATE_RESULT;
@@ -115,8 +116,10 @@ static int llparse_byte(struct llparser *llp, char byte)
case LLPARSE_STATE_IDLE_CR:
if (byte == '\n')
llp->state = LLPARSE_STATE_IDLE_LF;
- else if (byte != '\r')
+ else if (byte != '\r') {
+ DEBUGP("IDLE_CR: no \\r following \\n\n");
llp->state = LLPARSE_STATE_ERROR;
+ }
break;
case LLPARSE_STATE_IDLE_LF:
/* can we really go directly into result_cr ? */
@@ -156,9 +159,13 @@ static int llparse_byte(struct llparser *llp, char byte)
}
break;
case LLPARSE_STATE_ERROR:
+ DEBUGP("already in state ERROR\n");
break;
}
+ if (llp->state == LLPARSE_STATE_ERROR)
+ exit(5);
+
return ret;
}
personal git repositories of Harald Welte. Your mileage may vary