From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH] common: fix buffer length in phone_number_to_string
Date: Wed, 23 Mar 2011 18:16:35 +0100 [thread overview]
Message-ID: <1300900595-32375-1-git-send-email-frederic.danis@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]
update buffer length related to OFONO_MAX_PHONE_NUMBER_LENGTH change
78c1e96bf9601b5e5d31d04413baa1265a1c284f
---
src/common.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/common.c b/src/common.c
index 520360c..e65a677 100644
--- a/src/common.c
+++ b/src/common.c
@@ -422,16 +422,16 @@ int mmi_service_code_to_bearer_class(int code)
const char *phone_number_to_string(const struct ofono_phone_number *ph)
{
- static char buffer[64];
+ static char buffer[OFONO_MAX_PHONE_NUMBER_LENGTH + 2];
if (ph->type == 145 && (strlen(ph->number) > 0) &&
ph->number[0] != '+') {
buffer[0] = '+';
- strncpy(buffer + 1, ph->number, 62);
- buffer[63] = '\0';
+ strncpy(buffer + 1, ph->number, OFONO_MAX_PHONE_NUMBER_LENGTH);
+ buffer[OFONO_MAX_PHONE_NUMBER_LENGTH + 1] = '\0';
} else {
- strncpy(buffer, ph->number, 63);
- buffer[63] = '\0';
+ strncpy(buffer, ph->number, OFONO_MAX_PHONE_NUMBER_LENGTH + 1);
+ buffer[OFONO_MAX_PHONE_NUMBER_LENGTH + 1] = '\0';
}
return buffer;
--
1.7.1
next reply other threads:[~2011-03-23 17:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 17:16 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2011-03-23 20:03 ` [PATCH] common: fix buffer length in phone_number_to_string Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300900595-32375-1-git-send-email-frederic.danis@linux.intel.com \
--to=frederic.danis@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.