incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Zhong" <Scott.Zh...@roguewave.com>
Subject [PATCH] STDCXX-749 [HP aCC 6.16] Potential null pointer dereference in time.cpp
Date Thu, 20 Mar 2008 16:51:24 GMT
Index: time.cpp
===================================================================
--- time.cpp    (revision 634377)
+++ time.cpp    (working copy)
@@ -67,12 +67,16 @@
 
     // now get the offset
     tokp = std::strtok (0, ":");
+    if (NULL == tokp)
+        return;
     std::sscanf (tokp, "%d", &tmp_era.era_out.offset);
     if (direction == '-')
         tmp_era.era_out.offset *= -1;
     
     // now get the start date
     tokp = std::strtok (0, ":");
+    if (NULL == tokp)
+        return;
     unsigned int tmp_mon, tmp_day;
     std::sscanf (tokp, "%d/%u/%u", &tmp_era.era_out.year[0], 
                  &tmp_mon, &tmp_day);
@@ -83,6 +87,8 @@
 
     // now get the end date (this may be the beginning or end of time
     tokp = std::strtok (0, ":");
+    if (NULL == tokp)
+        return;
     if (std::strcmp (tokp, "-*") == 0) {
         tmp_era.era_out.year[1] = _RWSTD_INT_MIN;
         tmp_era.era_out.month[1] = _RWSTD_CHAR_MIN;

Mime
View raw message