Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 91471 invoked from network); 20 Mar 2008 16:51:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2008 16:51:20 -0000 Received: (qmail 78061 invoked by uid 500); 20 Mar 2008 16:51:18 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 78037 invoked by uid 500); 20 Mar 2008 16:51:18 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 78028 invoked by uid 99); 20 Mar 2008 16:51:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 09:51:18 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 16:50:39 +0000 Received: from exchmail01.Blue.Roguewave.Com (exchmail01.blue.roguewave.com [10.22.129.22]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m2KGon87008043 for ; Thu, 20 Mar 2008 16:50:49 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: [PATCH] STDCXX-749 [HP aCC 6.16] Potential null pointer dereference in time.cpp Date: Thu, 20 Mar 2008 10:51:24 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] STDCXX-749 [HP aCC 6.16] Potential null pointer dereference in time.cpp Thread-Index: AciKqnk1m/WAdAdyQ86X8D+hKXU1vQ== From: "Scott Zhong" To: X-Virus-Checked: Checked by ClamAV on apache.org Index: time.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- time.cpp (revision 634377) +++ time.cpp (working copy) @@ -67,12 +67,16 @@ =20 // now get the offset tokp =3D std::strtok (0, ":"); + if (NULL =3D=3D tokp) + return; std::sscanf (tokp, "%d", &tmp_era.era_out.offset); if (direction =3D=3D '-') tmp_era.era_out.offset *=3D -1; =20 // now get the start date tokp =3D std::strtok (0, ":"); + if (NULL =3D=3D tokp) + return; unsigned int tmp_mon, tmp_day; std::sscanf (tokp, "%d/%u/%u", &tmp_era.era_out.year[0],=20 &tmp_mon, &tmp_day); @@ -83,6 +87,8 @@ =20 // now get the end date (this may be the beginning or end of time tokp =3D std::strtok (0, ":"); + if (NULL =3D=3D tokp) + return; if (std::strcmp (tokp, "-*") =3D=3D 0) { tmp_era.era_out.year[1] =3D _RWSTD_INT_MIN; tmp_era.era_out.month[1] =3D _RWSTD_CHAR_MIN;