diff options
author | Allen Winter <winter@kde.org> | 2022-06-03 09:14:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 09:14:38 -0400 |
commit | a2be6d9ca1a1db38ce362a900675f527fc5d12b3 (patch) | |
tree | 9861c7b2e995a1650b9a52d0bf896e888ebd7bd3 /src/libical | |
parent | 7f704bd9dd9e76f055456fec39b5d037bfdce697 (diff) | |
parent | 6908abbf9238295910aef8d5259a8cc38c87329b (diff) | |
download | libical-git-mcclurgm-readme-mainpage.tar.gz |
Merge branch 'master' into mcclurgm-readme-mainpagemcclurgm-readme-mainpage
Diffstat (limited to 'src/libical')
-rw-r--r-- | src/libical/icaltime.c | 4 | ||||
-rw-r--r-- | src/libical/icalvalue.c | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libical/icaltime.c b/src/libical/icaltime.c index fd1bf3d8..33209508 100644 --- a/src/libical/icaltime.c +++ b/src/libical/icaltime.c @@ -434,7 +434,7 @@ static const int _days_in_month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, int icaltime_days_in_month(const int month, const int year) { - int days = _days_in_month[month]; + int days; /* The old code aborting if it was passed a parameter like BYMONTH=0 * Unfortunately it's not practical right now to pass an error all @@ -448,6 +448,8 @@ int icaltime_days_in_month(const int month, const int year) return 30; } + days = _days_in_month[month]; + if (month == 2) { days += icaltime_is_leap_year(year); } diff --git a/src/libical/icalvalue.c b/src/libical/icalvalue.c index 1becb059..e3053177 100644 --- a/src/libical/icalvalue.c +++ b/src/libical/icalvalue.c @@ -905,10 +905,13 @@ static char *icalvalue_utcoffset_as_ical_string_r(const icalvalue *value) m = (data - (h * 3600)) / 60; s = (data - (h * 3600) - (m * 60)); + h = MIN(abs(h), 23); + m = MIN(abs(m), 59); + s = MIN(abs(s), 59); if (s != 0) { - snprintf(str, 9, "%c%02d%02d%02d", sign, abs(h), abs(m), abs(s)); + snprintf(str, 9, "%c%02d%02d%02d", sign, h, m, s); } else { - snprintf(str, 9, "%c%02d%02d", sign, abs(h), abs(m)); + snprintf(str, 9, "%c%02d%02d", sign, h, m); } return str; |