[vlc-commits] iconv: handle NULL pointers (fixes #18677)
Rémi Denis-Courmont
git at videolan.org
Wed Aug 9 21:39:23 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug 9 22:34:27 2017 +0300| [23b45f037f47b043a9a6917310db509e7c398218] | committer: Rémi Denis-Courmont
iconv: handle NULL pointers (fixes #18677)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=23b45f037f47b043a9a6917310db509e7c398218
---
src/extras/libc.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/extras/libc.c b/src/extras/libc.c
index bb7faab769..12e35808f3 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -387,19 +387,25 @@ size_t vlc_iconv( vlc_iconv_t cd, const char **inbuf, size_t *inbytesleft,
#ifndef __linux__
if ( cd == (vlc_iconv_t)(-2) )
{
- unsigned char *out = (unsigned char *)*outbuf;
+ unsigned char *out = NULL;
+ if (outbuf != NULL)
+ out = (unsigned char *)*outbuf;
ret = ISO6937toUTF8( inbuf, inbytesleft, &out, outbytesleft );
- *outbuf = (char *)out;
+ if (outbuf != NULL)
+ *outbuf = (char *)out;
}
else
#endif
#if defined(HAVE_ICONV)
{
- ICONV_CONST char *cin = (ICONV_CONST char *)*inbuf;
+ ICONV_CONST char *cin = NULL;
+ if (inbuf != NULL)
+ cin = (ICONV_CONST char *)*inbuf;
ret = iconv( cd, &cin, inbytesleft, outbuf, outbytesleft );
- *inbuf = cin;
+ if (inbuf != NULL)
+ *inbuf = cin;
}
#else
abort ();
More information about the vlc-commits
mailing list