summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-04-08 11:21:28 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-04-08 11:21:28 +0200
commitb9980e498714e98e53688906ed3b876a1ad79ad1 (patch)
tree72aaf61157292c52d547be093f4668900115b4f1 /src/file_txt.c
parent821d1e698a15c29b3c20b4585c804e96ba317784 (diff)
PhotoRec: use get_time_from_xxx() new functions
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;