aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Fedorov <iam@datacompboy.ru>2018-01-05 22:09:44 +0100
committerGitHub <noreply@github.com>2018-01-05 22:09:44 +0100
commit473c5cff764b879be1f4afefb71d6b8ba0b8a9d3 (patch)
treedb9f722cce214527263dc0c7b598dbb140f7bbdc
parenta3868af12be724f808faa21a29e7b4931e30bed1 (diff)
downloadprotobuf-473c5cff764b879be1f4afefb71d6b8ba0b8a9d3.tar.gz
protobuf-473c5cff764b879be1f4afefb71d6b8ba0b8a9d3.tar.bz2
protobuf-473c5cff764b879be1f4afefb71d6b8ba0b8a9d3.zip
Fix ValidateDateTime: check day instead month
Found with PVS-Studio static analyser, see https://www.viva64.com/en/b/0550/
-rw-r--r--src/google/protobuf/stubs/time.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/google/protobuf/stubs/time.cc b/src/google/protobuf/stubs/time.cc
index 49c0412c..6def637e 100644
--- a/src/google/protobuf/stubs/time.cc
+++ b/src/google/protobuf/stubs/time.cc
@@ -80,9 +80,9 @@ bool ValidateDateTime(const DateTime& time) {
return false;
}
if (time.month == 2 && IsLeapYear(time.year)) {
- return time.month <= kDaysInMonth[time.month] + 1;
+ return time.day <= kDaysInMonth[time.month] + 1;
} else {
- return time.month <= kDaysInMonth[time.month];
+ return time.day <= kDaysInMonth[time.month];
}
}