summaryrefslogtreecommitdiff
path: root/src/gsmd/unsolicited.c
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2006-10-23 20:28:37 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2006-10-23 20:28:37 +0000
commitcbffc8d64707828b045b679e8db0269ae362ffcf (patch)
tree9ba71c11b92600548581af9d582a2c1feb18473f /src/gsmd/unsolicited.c
parent7fe163099476937a14dd7a0714de542f7f94f665 (diff)
more gsmd/libgsm implementation
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@114 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/gsmd/unsolicited.c')
-rw-r--r--src/gsmd/unsolicited.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gsmd/unsolicited.c b/src/gsmd/unsolicited.c
index 5242042..e97f478 100644
--- a/src/gsmd/unsolicited.c
+++ b/src/gsmd/unsolicited.c
@@ -217,6 +217,7 @@ static int clip_parse(char *buf, int len, const char *param,
if (!comma)
return -EINVAL;
+
if (comma - param > GSMD_ADDR_MAXLEN)
return -EINVAL;
@@ -308,7 +309,7 @@ static const struct gsmd_unsolicit gsm0707_unsolicit[] = {
/* called by midlevel parser if a response seems unsolicited */
int unsolicited_parse(struct gsmd *g, char *buf, int len, const char *param)
{
- int i;
+ int i, rc;
for (i = 0; i < ARRAY_SIZE(gsm0707_unsolicit); i++) {
const char *colon;
@@ -316,14 +317,20 @@ int unsolicited_parse(struct gsmd *g, char *buf, int len, const char *param)
strlen(gsm0707_unsolicit[i].prefix)))
continue;
- colon = strchr(buf, ':') + 1;
+ colon = strchr(buf, ':') + 2;
if (colon > buf+len)
colon = NULL;
- return gsm0707_unsolicit[i].parse(buf, len, colon, g);
+ rc = gsm0707_unsolicit[i].parse(buf, len, colon, g);
+ if (rc < 0)
+ gsmd_log(GSMD_ERROR, "error %d during parse of "
+ "unsolicied response `%s'\n", rc, buf);
+ return rc;
}
/* FIXME: call vendor-specific unsolicited code parser */
+ gsmd_log(GSMD_NOTICE, "no parser for unsolicited response `%s'\n", buf);
+
return -ENOENT;
}
personal git repositories of Harald Welte. Your mileage may vary