All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common: fix buffer length in phone_number_to_string
@ 2011-03-23 17:16 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-03-23 20:03 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-03-23 17:16 UTC (permalink / raw)
  To: ofono

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-23 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 17:16 [PATCH] common: fix buffer length in phone_number_to_string =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-23 20:03 ` Denis Kenzior

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.