[vlc-devel] [PATCH] stream_out/rapo: WriteAuxHeaders: prevent potential null-dereference

Filip Roséen filip at atch.se
Thu May 18 12:19:26 CEST 2017


vlc_dictionary_all_keys returns NULL on error, meaning that the
previous implementation could result in a null-pointer dereference.
---
 modules/stream_out/raop.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/stream_out/raop.c b/modules/stream_out/raop.c
index 48b7cd18f6..0903fc9ac0 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -722,6 +722,10 @@ static void WriteAuxHeaders( struct vlc_memstream *restrict stream,
                              vlc_dictionary_t *p_req_headers )
 {
     char **ppsz_keys = vlc_dictionary_all_keys( p_req_headers );
+
+    if( unlikely( !ppsz_keys ) )
+        return;
+
     for( size_t i = 0; ppsz_keys[i] != NULL; i++ )
     {
         char *name = ppsz_keys[i];
-- 
2.12.2


More information about the vlc-devel mailing list