From 4a965b6b43225b0b4cd4f258a31e2d3db85f4193 Mon Sep 17 00:00:00 2001 From: laforge Date: Tue, 1 May 2007 23:39:49 +0000 Subject: make CLIP/COLP numbers zero-terminated (Closes: #525) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1892 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/unsolicited.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gsmd/unsolicited.c b/src/gsmd/unsolicited.c index 251f4ed..b9bd97f 100644 --- a/src/gsmd/unsolicited.c +++ b/src/gsmd/unsolicited.c @@ -254,7 +254,8 @@ static int clip_parse(char *buf, int len, const char *param, if (comma - param > GSMD_ADDR_MAXLEN) return -EINVAL; - memcpy(aux->u.clip.addr.number, param, comma-param); + aux->u.clip.addr.number[0] = '\0'; + strncat(aux->u.clip.addr.number, param, comma-param); /* FIXME: parse of subaddr, etc. */ return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_CLIP); @@ -280,7 +281,8 @@ static int colp_parse(char *buf, int len, const char *param, if (comma - param > GSMD_ADDR_MAXLEN) return -EINVAL; - memcpy(aux->u.colp.addr.number, param, comma-param); + aux->u.colp.addr.number[0] = '\0'; + strncat(aux->u.colp.addr.number, param, comma-param); /* FIXME: parse of subaddr, etc. */ return usock_evt_send(gsmd, ucmd, GSMD_EVT_OUT_COLP); -- cgit v1.2.3