summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index b558020..a65842f 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -573,20 +573,9 @@ static int header_check_ics(const unsigned char *buffer, const unsigned int buff
date_asc=strstr(buffer2, "DTSTART");
if(date_asc!=NULL)
date_asc=strchr(date_asc, ':');
- if(date_asc!=NULL && date_asc-buffer2<=buffer_size-14)
+ if(date_asc!=NULL && date_asc+1+14 < buffer2+buffer_size)
{
- struct tm tm_time;
- memset(&tm_time, 0, sizeof(tm_time));
- date_asc++;
- tm_time.tm_sec=(date_asc[13]-'0')*10+(date_asc[14]-'0'); /* seconds 0-59 */
- tm_time.tm_min=(date_asc[11]-'0')*10+(date_asc[12]-'0'); /* minutes 0-59 */
- tm_time.tm_hour=(date_asc[9]-'0')*10+(date_asc[10]-'0'); /* hours 0-23*/
- tm_time.tm_mday=(date_asc[6]-'0')*10+(date_asc[7]-'0'); /* day of the month 1-31 */
- tm_time.tm_mon=(date_asc[4]-'0')*10+(date_asc[5]-'0')-1; /* month 0-11 */
- tm_time.tm_year=(date_asc[0]-'0')*1000+(date_asc[1]-'0')*100+
- (date_asc[2]-'0')*10+(date_asc[3]-'0')-1900; /* year */
- tm_time.tm_isdst = -1; /* unknown daylight saving time */
- file_recovery_new->time=mktime(&tm_time);
+ file_recovery_new->time=get_time_from_YYYYMMDD_HHMMSS(date_asc+1);
}
free(buffer2);
return 1;