Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / libaddressinput / src / cpp / src / validating_util.cc
index 6b52e8b..084c09c 100644 (file)
@@ -84,7 +84,10 @@ bool UnwrapHeader(const char* header_prefix,
 void ValidatingUtil::Wrap(time_t timestamp, std::string* data) {
   assert(data != NULL);
   char timestamp_string[2 + 3 * sizeof timestamp];
-  snprintf(timestamp_string, sizeof timestamp_string, "%ld", timestamp);
+  int size = std::sprintf(timestamp_string, "%ld", timestamp);
+  assert(size > 0);
+  assert(size < sizeof timestamp_string);
+  (void)size;
 
   std::string header;
   header.append(kTimestampPrefix, kTimestampPrefixLength);
@@ -108,7 +111,7 @@ bool ValidatingUtil::UnwrapTimestamp(std::string* data, time_t now) {
 
   std::string timestamp_string;
   if (!UnwrapHeader(
-           kTimestampPrefix, kTimestampPrefixLength, data, &timestamp_string)) {
+          kTimestampPrefix, kTimestampPrefixLength, data, &timestamp_string)) {
     return false;
   }