From 07b3072b0a98d197a231ef94f19c7f68fab92389 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Tue, 21 Dec 2010 15:44:25 -0500 Subject: [PATCH] lib: fixed field builder bug in Tasks which created a short TIMEZONE_CODE The parser expects that the TIMEZONE_CODE field be 4 bytes, yet we only use the first 2. When building the record again, the bug only used the 2 byte code, and created a record that we couldn't parse. --- src/r_task.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/r_task.cc b/src/r_task.cc index b10fbde9..32c68e46 100644 --- a/src/r_task.cc +++ b/src/r_task.cc @@ -265,8 +265,12 @@ void Task::BuildFields(Data &data, size_t &offset, const IConverter *ic) const else BuildField(data, offset, TSKFC_DUE_FLAG, (char) 0); - if( TimeZoneValid ) - BuildField(data, offset, TSKFC_TIMEZONE_CODE, TimeZoneCode); + if( TimeZoneValid ) { + // the time zone code field is 4 bytes, but we only use + // the first two... pad it with zeros + uint32_t code = TimeZoneCode; + BuildField(data, offset, TSKFC_TIMEZONE_CODE, code); + } // cycle through the type table for( FieldLink *b = TaskFieldLinks; -- 2.11.4.GIT