Hi,

The libxdg-basedir package has an overflow bug. This causes
games/openttd to crash on startup if "sysctl vm.malloc_conf=C" (or S).

Upstream fixed the bug in 2014. However, the latest release is
libxdg-basedir-1.2.0, which in three weeks will be eight years old.

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/libxdg-basedir/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- Makefile    12 Jul 2019 20:51:15 -0000      1.10
+++ Makefile    3 Jan 2020 10:38:25 -0000
@@ -5,7 +5,7 @@ COMMENT =       implementation of the XDG Base
 DISTNAME =     libxdg-basedir-1.2.0
 SHARED_LIBS +=  xdg-basedir    2.0     # .3.0
 CATEGORIES =   x11 devel
-REVISION =     1
+REVISION =     2
 
 # MIT
 PERMIT_PACKAGE =       Yes
Index: patches/patch-src_basedir_c
===================================================================
RCS file: /cvs/ports/x11/libxdg-basedir/patches/patch-src_basedir_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_basedir_c
--- patches/patch-src_basedir_c 15 Dec 2010 13:22:03 -0000      1.2
+++ patches/patch-src_basedir_c 3 Jan 2020 10:38:25 -0000
@@ -1,6 +1,9 @@
 $OpenBSD: patch-src_basedir_c,v 1.2 2010/12/15 13:22:03 dcoppa Exp $
---- src/basedir.c.orig Tue Jul 13 07:48:54 2010
-+++ src/basedir.c      Wed Dec 15 14:13:49 2010
+Overflow fix from upstream:
+https://github.com/devnev/libxdg-basedir/commit/14e000f696ef8b83264b0ca4407669bdb365fb23
+Index: src/basedir.c
+--- src/basedir.c.orig
++++ src/basedir.c
 @@ -91,13 +91,12 @@ static void xdgZeroMemory(void* p, int n)
  static const char
        DefaultRelativeDataHome[] = DIR_SEPARATOR_STR ".local" 
DIR_SEPARATOR_STR "share",
@@ -18,3 +21,12 @@ $OpenBSD: patch-src_basedir_c,v 1.2 2010
        *DefaultConfigDirectoriesList[] = { DefaultConfigDirectories, NULL };
  
  typedef struct _xdgCachedData
+@@ -574,7 +573,7 @@ static char * xdgGetRelativeHome(const char *envname, 
+               unsigned int homelen;
+               if (!(home = xdgGetEnv("HOME")))
+                       return NULL;
+-              if (!(relhome = (char*)malloc((homelen = 
strlen(home))+fallbacklength))) return NULL;
++              if (!(relhome = (char*)malloc((homelen = 
strlen(home))+fallbacklength+1))) return NULL;
+               memcpy(relhome, home, homelen);
+               memcpy(relhome+homelen, relativefallback, fallbacklength+1);
+       }

Reply via email to