]> git.pond.sub.org Git - empserver/commitdiff
w32/strptime: Fix for 64 bit pointers
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Apr 2015 07:45:11 +0000 (09:45 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 14 May 2015 07:39:19 +0000 (09:39 +0200)
The __UNCONST() stolen from NetBSD assumes unsigned long can hold a
pointer.  Not true with Win64's LLP64 data model.  There, we cast the
64 bit pointer to 32 bits and back.  Works only because Windows puts
the stack at a very low address, and the casts don't actually change
the pointer.

Dumb it down to a straight cast to void * for safety.

Thanks to Harald Katzer and Ron Koenderink for their help figuring out
the bug's impact.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/w32/strptime.c

index 9a83a6b1c4be7d8f73d914cd94cdcaa22ba29580..123f4c7b397bb28144a01b2275f75bcaab576ab8 100644 (file)
@@ -48,7 +48,7 @@ static const TimeLocale DefaultTimeLocale =
 
 #define _CurrentTimeLocale (&DefaultTimeLocale)
 #define TM_YEAR_BASE 1900
-#define __UNCONST(a)   ((void *)(unsigned long)(const void *)(a))
+#define __UNCONST(a) ((void *)(a))
 
 /*     $NetBSD: strptime.c,v 1.28 2008/04/28 20:23:01 martin Exp $     */