--- libical-0.44-pristine/src/libical/icalrecur.c 2014-02-19 16:20:40.000000000 +0100 +++ libical-0.44/src/libical/icalrecur.c 2014-07-14 20:09:16.000000000 +0200 @@ -2140,6 +2140,10 @@ } else if (pos > 0) { /* Add the nth instance of the weekday within the month. */ month_day = first_matching_day + (pos - 1) * 7; + + /* Track back overflowing days */ + while(month_day > days_in_month) + month_day -=7; if (month_day <= days_in_month) impl->days[days_index++] = (short)(doy_offset + month_day);