[vlc-commits] strings: vlc_xml_encode: check return of vlc_memstream_open
Filip Roséen
git at videolan.org
Mon Mar 6 09:12:44 CET 2017
vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Feb 24 21:32:56 2017 +0100| [705a427f75915d9951f62fa86851693dc16a73a7] | committer: Jean-Baptiste Kempf
strings: vlc_xml_encode: check return of vlc_memstream_open
As the function is not guaranteed to succeed we should check the return-value
in order to prevent potentially using a handle which is not valid.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=705a427f75915d9951f62fa86851693dc16a73a7
---
src/text/strings.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/text/strings.c b/src/text/strings.c
index eb45145..7adfbcd 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -289,7 +289,9 @@ char *vlc_xml_encode (const char *str)
uint32_t cp;
assert(str != NULL);
- vlc_memstream_open(&stream);
+
+ if (vlc_memstream_open(&stream))
+ return NULL;
while ((n = vlc_towc (str, &cp)) != 0)
{
More information about the vlc-commits
mailing list