From 95ff4f397f0246accb76354a0cb59aa684a53377 Mon Sep 17 00:00:00 2001 From: is Date: Mon, 15 Oct 2012 15:29:09 +0000 Subject: xlock -mode dclock would segfault on OSes with sizeof(time_t)>sizeof(long); this includes NetBSD-6 on 32bit systems. As a result, xlock -mode random (the default) would eventually unlock the screen, without the user being aware of this (as she/he's can be presumed to have left the monitor). The reason was that some variables in dclock.c were declared long, but contain essentially time_t values. In on case, a pointer to such a variable was casted to (struct time_t *) and passed to localtime(), and the resulting pointer is not checked for error before being used. The variables have been changed to time_t and the typecast has been removed. --- x11/xlockmore-lite/Makefile | 4 +-- x11/xlockmore/Makefile | 4 +-- x11/xlockmore/distinfo | 3 ++- x11/xlockmore/patches/patch-modes_dclock.c | 40 ++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 x11/xlockmore/patches/patch-modes_dclock.c diff --git a/x11/xlockmore-lite/Makefile b/x11/xlockmore-lite/Makefile index 509ebf8b483..b4cc790f0be 100644 --- a/x11/xlockmore-lite/Makefile +++ b/x11/xlockmore-lite/Makefile @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.15 2012/06/15 23:06:08 dholland Exp $ +# $NetBSD: Makefile,v 1.16 2012/10/15 15:29:10 is Exp $ .include "../../x11/xlockmore/Makefile.common" PKGNAME= ${DISTNAME:S/-/-lite-/} -PKGREVISION= 1 +PKGREVISION= 2 COMMENT= "lite" version of xlockmore CONFIGURE_ARGS+= --without-xpm diff --git a/x11/xlockmore/Makefile b/x11/xlockmore/Makefile index d56e5b5c097..ecce28e7447 100644 --- a/x11/xlockmore/Makefile +++ b/x11/xlockmore/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.99 2012/10/08 23:02:40 adam Exp $ +# $NetBSD: Makefile,v 1.100 2012/10/15 15:29:09 is Exp $ .include "Makefile.common" -PKGREVISION= 5 +PKGREVISION= 6 COMMENT= Like the XLock session-locker/screensaver, but with more diff --git a/x11/xlockmore/distinfo b/x11/xlockmore/distinfo index 205a123f621..d02fb57b6b7 100644 --- a/x11/xlockmore/distinfo +++ b/x11/xlockmore/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.48 2012/02/13 11:46:13 drochner Exp $ +$NetBSD: distinfo,v 1.49 2012/10/15 15:29:09 is Exp $ SHA1 (xlockmore-5.38.tar.bz2) = 5a0fd27209dfc0966a1ec691f9ea4416587082bf RMD160 (xlockmore-5.38.tar.bz2) = 227a2c13c8cf1ddb027138dc520874accf5c0f72 @@ -8,3 +8,4 @@ SHA1 (patch-ab) = 48bd5ea9389f646df5ffe290f3230b028916f0d1 SHA1 (patch-ac) = e05f4956c0b4bd9b90c86e5a1174aab5e474115f SHA1 (patch-ad) = a76c7d9f17dec5cf2a3de6d0c3343c80cf53d314 SHA1 (patch-ae) = b78d7d148c9a62dbdf72e05aeec8d22d10ab9cce +SHA1 (patch-modes_dclock.c) = b5863dab4153cbe19b54c2838c85df1a84f09a14 diff --git a/x11/xlockmore/patches/patch-modes_dclock.c b/x11/xlockmore/patches/patch-modes_dclock.c new file mode 100644 index 00000000000..b48c4cb9fd3 --- /dev/null +++ b/x11/xlockmore/patches/patch-modes_dclock.c @@ -0,0 +1,40 @@ +$NetBSD: patch-modes_dclock.c,v 1.1 2012/10/15 15:29:10 is Exp $ + +--- modes/dclock.c.orig 2012-01-23 13:19:21.000000000 +0000 ++++ modes/dclock.c +@@ -420,7 +420,7 @@ convert(double x, char *string) + } + + static void +-dayhrminsec(long timeCount, int tzoffset, char *string) ++dayhrminsec(time_t timeCount, int tzoffset, char *string) + { + int days, hours, minutes, secs; + int bufsize, i; +@@ -675,7 +675,7 @@ drawDclock(ModeInfo * mi) + "%a %b %d %Y", localtime(&(dp->timeold))); + } + } else { +- long timeNow, timeLocal; ++ time_t timeNow, timeLocal; + timeNow = seconds(); + timeLocal = timeNow + dp->tzoffset; + +@@ -950,7 +950,7 @@ init_dclock(ModeInfo * mi) + { + Display *display = MI_DISPLAY(mi); + dclockstruct *dp; +- long timeNow, timeLocal; ++ time_t timeNow, timeLocal; + int i, j; + + if (dclocks == NULL) { +@@ -1252,7 +1252,7 @@ defined(MODE_dclock_mayan) + dayhrminsec(MAYAN_TIME_START - timeLocal, dp->tzoffset, dp->strnew[1]); + dp->strpta[1] = dp->strnew[1]; + } else { +- struct tm *t = localtime((const time_t *) &timeLocal); ++ struct tm *t = localtime(&timeLocal); + + if (dp->time24) + (void) strftime(dp->strnew[0], STRSIZE, "%H:%M:%S", t); -- cgit v1.2.3