Timestamp incorrectly calculated for timezones with minute offset

Bug #798333 reported by Ed Swierk on 2011-06-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rsyslog
Fix Released
Medium
rsyslog (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: rsyslog

If you run rsyslog with $ActionFileDefaultTemplate set to RSYSLOG_FileFormat and set the system timezone to Australia/Adelaide, log messages incorrectly show the offset as +09:08 rather than +09:30.

Affects all versions of rsyslog in oneiric, natty, maverick, and lucid. Fixed upstream.

http://bugzilla.adiscon.com/show_bug.cgi?id=271

If you run rsyslog with $ActionFileDefaultTemplate set to RSYSLOG_FileFormat and set the system timezone to Australia/Adelaide, log messages incorrectly show the offset as +09:08 rather than +09:30.

getCurrTime() in datetime.c tries to convert the timezone offset in seconds (lBias) to OffsetHour and OffsetMinutes:

  t->OffsetHour = lBias / 3600;
  t->OffsetMinute = lBias % 3600;

lBias % 3600 gives the remainder in seconds, not minutes. Since OffsetMinute is a char, the result is effectively (lBias % 3600) % 256, which happens to be 8 in the case of the Australia/Adelaide timezone.

To fix this bug the second line should instead read:

  t->OffsetMinute = (lBias % 3600) / 60;

confirmed as far back as v3 (earlier versions not checked)

fixed in 3.22.4, 4.6.6, 5.8.2, 5.9.1. Fix for v6 with next merge (which is a large task to do).

"Official" patch here:

http://git.adiscon.com/?p=rsyslog.git;a=commitdiff;h=da52cbae520e747568162ad558bf01d40658c745

Thanks for the bug report and analysis!

Ed Swierk (eswierk) on 2011-06-16
description: updated
Changed in rsyslog:
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.