diff mbox

[android/bionic] strftime: Use snprintf() instead of sprintf()

Message ID BANLkTikd1+osa5aXkp+8=gb==_J31yrmGA@mail.gmail.com
State New
Headers show

Commit Message

Jim Huang June 22, 2011, 8:48 a.m. UTC
Code Review:
    https://review.source.android.com/#change,23997

Comments

Jim Huang June 23, 2011, 3:02 p.m. UTC | #1
Merged in AOSP:
    http://android.git.kernel.org/?p=platform/bionic.git;a=commitdiff;h=e6cff939e603e445c2576958c3777d7b7f5d84fa

On 22 June 2011 16:48, Jim Huang <jim.huang@linaro.org> wrote:
> Code Review:
>    https://review.source.android.com/#change,23997
diff mbox

Patch

From afd989ca9f3415df9807847745e854522866f66f Mon Sep 17 00:00:00 2001
From: Jim Huang <jim.huang@linaro.org>
Date: Thu, 16 Jun 2011 22:35:16 +0800
Subject: [PATCH 1/2] strftime: Use snprintf() instead of sprintf()

Change-Id: I112ac012894eddc96e5f3e77cb87bb300596e3ce
---
 libc/tzcode/strftime.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c
index ab713fb..d35d58a 100644
--- a/libc/tzcode/strftime.c
+++ b/libc/tzcode/strftime.c
@@ -407,9 +407,9 @@  label:
                     tm = *t;
                     mkt = mktime64(&tm);
                     if (TYPE_SIGNED(time64_t))
-                        (void) sprintf(buf, "%lld",
+                        (void) snprintf(buf, "%lld", sizeof(buf),
                             (long long) mkt);
-                    else    (void) sprintf(buf, "%llu",
+                    else    (void) snprintf(buf, "%llu", sizeof(buf),
                             (unsigned long long) mkt);
                     pt = _add(buf, pt, ptlim, modifier);
                 }
-- 
1.7.5.4