diff options
author | Michael Vogt <mvo@debian.org> | 2011-04-04 16:49:21 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2011-04-04 16:49:21 +0200 |
commit | bee9ae120eeaf9f43c9688440fc3fdb8d02bf94a (patch) | |
tree | 16f267931477609dca384e60b02cf3819764e171 /apt-pkg/contrib/strutl.cc | |
parent | 3a1f49c42aae17c23d52486db21fb7c05734dbd2 (diff) | |
parent | 410327e1ee0fac0c28a95e45ea75f7359cc8dcb4 (diff) |
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 2e2bb5ebc..072dda3ac 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -692,14 +692,16 @@ int StringToBool(const string &Text,int Default) year 2000 complient and timezone neutral */ string TimeRFC1123(time_t Date) { - struct tm Conv = *gmtime(&Date); - char Buf[300]; + struct tm Conv; + if (gmtime_r(&Date, &Conv) == NULL) + return ""; + char Buf[300]; const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul", "Aug","Sep","Oct","Nov","Dec"}; - sprintf(Buf,"%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday], + snprintf(Buf, sizeof(Buf), "%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday], Conv.tm_mday,Month[Conv.tm_mon],Conv.tm_year+1900,Conv.tm_hour, Conv.tm_min,Conv.tm_sec); return Buf; |