[vlc-devel] [PATCH 1/2] vlc_fixups: fix crash when NULL is passed to strdup() on OS/2

KO Myung-Hun komh78 at gmail.com
Tue Dec 20 13:37:54 CET 2016


On OS/2, strdup() crashes if NULL is passed.

When trying to play some clips such as
http://www.ecomstation.co.kr/komh/testcase/svq1.mov, NULL is passed to
psz_value of vlc_meta_AddExtra(). psz_value is passed to strdup(). As a
result, crash occurs.
---
 include/vlc_fixups.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 3b80f9d..32ebe2a 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -477,6 +477,10 @@ void freeaddrinfo (struct addrinfo *res);
 # ifndef EPROTO
 #  define EPROTO (ELAST + 1)
 # endif
+
+/* strdup() crashes if NULL is passed */
+# include <string.h>
+# define strdup(str) ((str) ? strdup(str) : NULL)
 #endif
 
 /* math.h */
-- 
2.9.2



More information about the vlc-devel mailing list