diff options
author | Anton Fedorov <iam@datacompboy.ru> | 2018-01-05 22:09:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-05 22:09:44 +0100 |
commit | 473c5cff764b879be1f4afefb71d6b8ba0b8a9d3 (patch) | |
tree | db9f722cce214527263dc0c7b598dbb140f7bbdc /src/google | |
parent | a3868af12be724f808faa21a29e7b4931e30bed1 (diff) | |
download | protobuf-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/
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/stubs/time.cc | 4 |
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]; } } |