File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -731,10 +731,10 @@ void Correct_year_addition_struct_tm()
731731}
732732
733733/* *
734- * Negative Case - Anti-pattern 1: [year ±n, month, day]
734+ * Positive Case - Anti-pattern 1: [year ±n, month, day]
735735 * Years is incremented by some integer and leap year is not handled correctly.
736736*/
737- void Correct_LinuxPattern ()
737+ void Incorrect_LinuxPattern ()
738738{
739739 time_t rawtime;
740740 struct tm timeinfo;
@@ -743,7 +743,7 @@ void Correct_LinuxPattern()
743743 errno_t err = gmtime_s (&timeinfo, &rawtime);
744744
745745 /* from 1900 -> from 1980 */
746- timeinfo.tm_year -= 80 ;
746+ timeinfo.tm_year -= 80 ; // bug - no check for leap year
747747 /* 0~11 -> 1~12 */
748748 timeinfo.tm_mon ++;
749749 /* 0~59 -> 0~29(2sec counts) */
You can’t perform that action at this time.
0 commit comments