From patchwork Wed Jun 22 08:48:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Huang X-Patchwork-Id: 2151 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 056B123F08 for ; Wed, 22 Jun 2011 08:48:09 +0000 (UTC) Received: from mail-vw0-f52.google.com (mail-vw0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id BB192A18036 for ; Wed, 22 Jun 2011 08:48:08 +0000 (UTC) Received: by vws16 with SMTP id 16so661861vws.11 for ; Wed, 22 Jun 2011 01:48:08 -0700 (PDT) Received: by 10.52.162.72 with SMTP id xy8mr578176vdb.87.1308732488222; Wed, 22 Jun 2011 01:48:08 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs123147vdc; Wed, 22 Jun 2011 01:48:08 -0700 (PDT) Received: by 10.227.11.142 with SMTP id t14mr430332wbt.103.1308732487323; Wed, 22 Jun 2011 01:48:07 -0700 (PDT) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id ff9si848146wbb.48.2011.06.22.01.48.06 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2011 01:48:06 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of jim.huang@linaro.org) client-ip=74.125.82.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of jim.huang@linaro.org) smtp.mail=jim.huang@linaro.org Received: by wwg11 with SMTP id 11so1014364wwg.1 for ; Wed, 22 Jun 2011 01:48:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.69.205 with SMTP id n55mr458492wed.35.1308732485480; Wed, 22 Jun 2011 01:48:05 -0700 (PDT) Received: by 10.216.12.71 with HTTP; Wed, 22 Jun 2011 01:48:05 -0700 (PDT) Date: Wed, 22 Jun 2011 16:48:05 +0800 Message-ID: Subject: [PATCH android/bionic] strftime: Use snprintf() instead of sprintf() From: Jim Huang To: linaro-dev Cc: patches Code Review: https://review.source.android.com/#change,23997 >From afd989ca9f3415df9807847745e854522866f66f Mon Sep 17 00:00:00 2001 From: Jim Huang 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