[PATCH 2/4] Replace sprintf with snprintf

Zhenhua Zhang zhenhua.zhang at intel.com
Tue Feb 9 06:59:28 PST 2010


---
 gatchat/gatserver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 16c976d..ad6afb9 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -116,9 +116,10 @@ static void g_at_server_send_result(GAtServer *server, GAtServerResult result)
 		return;
 
 	if (v250.is_v1)
-		sprintf(buf, "%c%c%s%c%c", t, r, result_str, t, r);
+		snprintf(buf, sizeof(buf), "%c%c%s%c%c", t, r, result_str,
+				t, r);
 	else
-		sprintf(buf, "%u%c", (unsigned int) result, t);
+		snprintf(buf, sizeof(buf), "%u%c", (unsigned int) result, t);
 
 	g_at_util_debug_chat(FALSE, buf, strlen(buf),
 				server->debugf, server->debug_data);
-- 
1.6.6.1



More information about the ofono mailing list