diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 10eabe2ec415ce2d1bdab53092c40748676c9ec4..8e2c36a216eadc963d90cc159fcd541554e072a3 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -645,7 +645,7 @@ static bool get_path( stream_t *p_access )
     backslash_path( p_sys->psz_fullpath );
 
     /* Is path longer than just "/" ? */
-    if( strlen( p_sys->psz_fullpath ) > 1 )
+    if( strnlen( p_sys->psz_fullpath, 1+1 ) > 1 )
     {
         iter = p_sys->psz_fullpath;
         while( *iter == '\\' ) iter++; /* Handle smb://Host/////Share/ */
diff --git a/modules/codec/atsc_a65.c b/modules/codec/atsc_a65.c
index 26cb0ad8257667051c74766ce4b6aa603706170b..f6afa978e052f355f4cd979b797bb718e335b02a 100644
--- a/modules/codec/atsc_a65.c
+++ b/modules/codec/atsc_a65.c
@@ -72,7 +72,7 @@ atsc_a65_handle_t *atsc_a65_handle_New( const char *psz_lang )
     atsc_a65_handle_t *p_handle = malloc( sizeof(*p_handle) );
     if( p_handle )
     {
-        if( psz_lang && strlen(psz_lang) > 2 )
+        if( psz_lang && strnlen(psz_lang, 2+1) > 2 )
             p_handle->psz_lang = strdup( psz_lang );
         else
             p_handle->psz_lang = NULL;
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index 475ac7e41c39208aeeaa7d3e9f899156d1423792..c1ba15b3f55740c598be6ac0dce57aefe3e0a6f1 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -180,7 +180,7 @@ static int Create( vlc_object_t *p_this )
         if( !strcasecmp( p_attach->psz_mime, "application/x-truetype-font" ) )
             found = true;
         /* Then extension */
-        else if( !found && strlen( p_attach->psz_name ) > 4 )
+        else if( !found && strnlen( p_attach->psz_name, 4+1 ) > 4 )
         {
             char *ext = p_attach->psz_name + strlen( p_attach->psz_name ) - 4;
 
diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 7e6aed88bff86a118764b8f6c7bcd26bfe22a825..fbe9ddf93ece706b3137076b58f50b99fcdc5444 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -507,7 +507,7 @@ static int MimeDemux( demux_t *p_demux )
         /* Handle old and new style of separators */
         if (!strncmp(p_sys->psz_separator, (char *)(p_sys->p_peek + i + 2),
                      strlen( p_sys->psz_separator ))
-         || ((strlen(p_sys->psz_separator) > 4)
+         || ((strnlen(p_sys->psz_separator, 4+1) > 4)
           && !strncmp(p_sys->psz_separator, "--", 2)
           && !strncmp(p_sys->psz_separator, (char *)(p_sys->p_peek + i),
                       strlen( p_sys->psz_separator))))
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index a1e1b8559a2fe946c640a50a33343056b879f826..681c45ed6d2e12db6d24bf5b64f365a186d19873 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -192,7 +192,7 @@ static int OpenInternal( demux_t *p_demux, bool trust_cues )
                 const char *psz_file;
                 while ((psz_file = vlc_readdir(p_src_dir)) != NULL)
                 {
-                    if (strlen(psz_file) > 4)
+                    if (strnlen(psz_file, 4+1) > 4)
                     {
                         s_filename = s_path + DIR_SEP_CHAR + psz_file;
 
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 7c030da425451b2a3fece15551ceec66584628a0..dbb0859c37fa56ebb73f96384e09ef5a963460e3 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -766,7 +766,7 @@ char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url )
         inclport = false;
 
         /* Check against URL format rtsp://[<ipv6>]:<port>/<path> */
-        bool ipv6 = rtsp_url != NULL && strlen( rtsp_url ) > 7
+        bool ipv6 = rtsp_url != NULL && strnlen( rtsp_url, 7+1 ) > 7
                     && rtsp_url[7] == '[';
 
         /* Dummy destination address for RTSP */