diff options
author | Mike Haben <michael.haben@btinternet.com> | 2009-10-26 20:36:34 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-10-26 20:39:26 +0100 |
commit | 2449b37dfe424248ea9fe2143efb78a3cd385d64 (patch) | |
tree | e9b939fed62cc7b978fbb5477aea2169001587e8 /openbsc/src/ussd.c | |
parent | dc329a6cdb204d89c15599ca606e239dde368e7f (diff) |
[USSD] various USSD improvements
- Improved handling of extension-number string (as per review)
- Guard against a buffer-overflow if mobile sends a too-long USSD
- declare some function-parameters const
- fix gsm_ts_name function to display the right BTS number (bts->nr rather than bts->bts_nr)
Diffstat (limited to 'openbsc/src/ussd.c')
-rw-r--r-- | openbsc/src/ussd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openbsc/src/ussd.c b/openbsc/src/ussd.c index e414b1cea..a3d11f080 100644 --- a/openbsc/src/ussd.c +++ b/openbsc/src/ussd.c @@ -63,9 +63,9 @@ int handle_rcv_ussd(struct msgb *msg) static int send_own_number(const struct msgb *msg, const struct ussd_request *req) { char *own_number = msg->lchan->subscr->extension; - /* Need trailing CR as EOT character */ - char response_string[] = "Your extension is xxxxx\r"; + char response_string[GSM_EXTENSION_LENGTH + 20]; - memcpy(response_string + 18, own_number, 5); + /* Need trailing CR as EOT character */ + snprintf(response_string, sizeof(response_string), "Your extension is %s\r", own_number); return gsm0480_send_ussd_response(msg, response_string, req); } |