[vlc-commits] commit: Contribs: try to fix CDDB crash on Windows (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Sun Nov 28 21:24:13 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Nov 28 20:43:47 2010 +0100| [30afde38de0555135b43730e451c2eec3af9cbc2] | committer: Jean-Baptiste Kempf 

Contribs: try to fix CDDB crash on Windows

Ref #3804

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30afde38de0555135b43730e451c2eec3af9cbc2
---

 .../contrib/src/Patches/libcddb-getenv-crash.patch |   23 ++++++++++++++++++++
 extras/contrib/src/contrib-src.mak                 |    1 +
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/extras/contrib/src/Patches/libcddb-getenv-crash.patch b/extras/contrib/src/Patches/libcddb-getenv-crash.patch
new file mode 100644
index 0000000..48888ef
--- /dev/null
+++ b/extras/contrib/src/Patches/libcddb-getenv-crash.patch
@@ -0,0 +1,23 @@
+--- libcddb/lib/cddb_conn.c	2006-10-15 13:53:11.000000000 +0200
++++ libcddb.new/lib/cddb_conn.c	2010-11-28 21:03:39.012749230 +0100
+@@ -100,9 +100,17 @@
+         c->use_cache = CACHE_ON;
+         /* construct cache dir '$HOME/[DEFAULT_CACHE]' */
+         s = getenv("HOME");
+-        c->cache_dir = (char*)malloc(strlen(s) + 1 + sizeof(DEFAULT_CACHE) + 1);
+-        sprintf(c->cache_dir, "%s/%s", s, DEFAULT_CACHE);
+-        c->cache_read = FALSE;
++        if( s )
++        {
++            c->cache_dir = (char*)malloc(strlen(s) + 1 + sizeof(DEFAULT_CACHE) + 1);
++            sprintf(c->cache_dir, "%s/%s", s, DEFAULT_CACHE);
++            c->cache_read = FALSE;
++        }
++        else
++        {
++            c->cache_dir = NULL;
++            c->use_cache = CACHE_OFF;
++        }
+ 
+         /* use anonymous at localhost */
+         c->user = strdup(DEFAULT_USER);
diff --git a/extras/contrib/src/contrib-src.mak b/extras/contrib/src/contrib-src.mak
index d7fe15f..4900a77 100644
--- a/extras/contrib/src/contrib-src.mak
+++ b/extras/contrib/src/contrib-src.mak
@@ -1515,6 +1515,7 @@ endif
 ifdef HAVE_WIN32
 	(cd $@; patch -p0 < ../Patches/libcddb-win32.patch )
 endif
+	patch -p0 < Patches/libcddb-getenv-crash.patch
 
 ifdef HAVE_WIN32
 .cddb: libcddb .regex



More information about the vlc-commits mailing list