pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11 xlock -mode dclock would segfault on OSes with siz...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0b965d4e9525
branches:  trunk
changeset: 610005:0b965d4e9525
user:      is <is%pkgsrc.org@localhost>
date:      Mon Oct 15 15:29:09 2012 +0000

description:
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.

diffstat:

 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(-)

diffs (86 lines):

diff -r 0c9eccbda1aa -r 0b965d4e9525 x11/xlockmore-lite/Makefile
--- a/x11/xlockmore-lite/Makefile       Mon Oct 15 13:14:26 2012 +0000
+++ b/x11/xlockmore-lite/Makefile       Mon Oct 15 15:29:09 2012 +0000
@@ -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 -r 0c9eccbda1aa -r 0b965d4e9525 x11/xlockmore/Makefile
--- a/x11/xlockmore/Makefile    Mon Oct 15 13:14:26 2012 +0000
+++ b/x11/xlockmore/Makefile    Mon Oct 15 15:29:09 2012 +0000
@@ -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 -r 0c9eccbda1aa -r 0b965d4e9525 x11/xlockmore/distinfo
--- a/x11/xlockmore/distinfo    Mon Oct 15 13:14:26 2012 +0000
+++ b/x11/xlockmore/distinfo    Mon Oct 15 15:29:09 2012 +0000
@@ -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-ac) = e05f4956c0b4bd9b90c86e5a1174aab5e474115f
 SHA1 (patch-ad) = a76c7d9f17dec5cf2a3de6d0c3343c80cf53d314
 SHA1 (patch-ae) = b78d7d148c9a62dbdf72e05aeec8d22d10ab9cce
+SHA1 (patch-modes_dclock.c) = b5863dab4153cbe19b54c2838c85df1a84f09a14
diff -r 0c9eccbda1aa -r 0b965d4e9525 x11/xlockmore/patches/patch-modes_dclock.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/xlockmore/patches/patch-modes_dclock.c        Mon Oct 15 15:29:09 2012 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index