summaryrefslogtreecommitdiffstats
path: root/drivers/stemodem/gprs-context.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-02-05 12:01:13 -0600
committerDenis Kenzior <denkenz@gmail.com>2010-02-05 12:01:13 -0600
commitced9692361cb9805b785d0b691936b3131ad29bf (patch)
treea58cc1910fac467a92aa30613393931cc828885e /drivers/stemodem/gprs-context.c
parentd223243913fab44322892148ad7d2651de3364d5 (diff)
downloadofono-ced9692361cb9805b785d0b691936b3131ad29bf.tar.bz2
Fix: Use snprintf instead of sprintf in stemodem
Diffstat (limited to 'drivers/stemodem/gprs-context.c')
-rw-r--r--drivers/stemodem/gprs-context.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index 6743aba3..eb378ed3 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -394,7 +394,8 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
conn = l->data;
conn->cid = gcd->active_context;
- sprintf(buf, "AT*EPPSD=1,%u,%u", conn->channel_id, conn->cid);
+ snprintf(buf, sizeof(buf), "AT*EPPSD=1,%u,%u",
+ conn->channel_id, conn->cid);
if (g_at_chat_send(gcd->chat, buf, NULL,
ste_eppsd_up_cb, ncbd, g_free) > 0)
@@ -426,13 +427,13 @@ static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
cbd->user = gc;
/* Set username and password */
- sprintf(buf, "AT*EIAAUW=%d,1,\"%s\",\"%s\"", ctx->cid,
- ctx->username, ctx->password);
+ snprintf(buf, sizeof(buf), "AT*EIAAUW=%d,1,\"%s\",\"%s\"",
+ ctx->cid, ctx->username, ctx->password);
if (g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL) == 0)
goto error;
- len = sprintf(buf, "AT+CGDCONT=%u,\"IP\"", ctx->cid);
+ len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
if (ctx->apn)
snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
@@ -476,7 +477,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
conn = l->data;
- sprintf(buf, "AT*EPPSD=0,%u,%u", conn->channel_id, id);
+ snprintf(buf, sizeof(buf), "AT*EPPSD=0,%u,%u", conn->channel_id, id);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
ste_eppsd_down_cb, cbd, g_free) > 0)