[Pkg-sysvinit-commits] r1419 - in sysvinit-upstream/trunk: doc src
Petter Reinholdtsen
pere at alioth.debian.org
Fri Jul 10 21:26:05 UTC 2009
Author: pere
Date: 2009-07-10 21:26:04 +0000 (Fri, 10 Jul 2009)
New Revision: 1419
Modified:
sysvinit-upstream/trunk/doc/Changelog
sysvinit-upstream/trunk/src/utmpdump.c
Log:
Avoid unchecked return value from malloc() in utmpdump.
Patch from Christian 'Dr. Disk' Hechelmann and Fedora.
Modified: sysvinit-upstream/trunk/doc/Changelog
===================================================================
--- sysvinit-upstream/trunk/doc/Changelog 2009-07-10 21:16:48 UTC (rev 1418)
+++ sysvinit-upstream/trunk/doc/Changelog 2009-07-10 21:26:04 UTC (rev 1419)
@@ -21,6 +21,8 @@
* Increase the compiler warning level when building.
* Fix utmp/wtmp updating on 64-bit platforms. Patch by Bill
Nottingham and Fedora.
+ * Avoid unchecked return value from malloc() in utmpdump.
+ Patch from Christian 'Dr. Disk' Hechelmann and Fedora.
-- Petter Reinholdtsen <pere at debian.org> Fri, 30 Jul 2004 14:14:58 +0200
Modified: sysvinit-upstream/trunk/src/utmpdump.c
===================================================================
--- sysvinit-upstream/trunk/src/utmpdump.c 2009-07-10 21:16:48 UTC (rev 1418)
+++ sysvinit-upstream/trunk/src/utmpdump.c 2009-07-10 21:26:04 UTC (rev 1419)
@@ -81,18 +81,20 @@
time_t
strtotime(const char *s_time)
{
- struct tm *tm = malloc(sizeof(*tm));
+ struct tm tm;
+
+ memset(&tm, '\0', sizeof(struct tm));
if (s_time[0] == ' ' || s_time[0] == '\0')
return (time_t)0;
- strptime(s_time, "%a %b %d %T %Y", tm);
+ strptime(s_time, "%a %b %d %T %Y", &tm);
/* Cheesy way of checking for DST */
if (s_time[26] == 'D')
- tm->tm_isdst = 1;
+ tm.tm_isdst = 1;
- return mktime(tm);
+ return mktime(&tm);
}
#define cleanse(x) xcleanse(x, sizeof(x))
More information about the Pkg-sysvinit-commits
mailing list