[vlc-commits] sap: fix off-by-one

Rémi Denis-Courmont git at videolan.org
Thu Nov 23 18:08:03 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 23 19:07:08 2017 +0200| [3264c9ed2e05ae841e8faaff7b217136cf31a99f] | committer: Rémi Denis-Courmont

sap: fix off-by-one

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3264c9ed2e05ae841e8faaff7b217136cf31a99f
---

 modules/services_discovery/sap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 3350240809..0f28dbf1b5 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -1185,6 +1185,9 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
     {
         /* Extract one line */
         size_t linelen = strcspn(psz_sdp, "\n");
+        if (psz_sdp[linelen] == '\0')
+            goto error;
+
         char line[linelen + 1];
         memcpy (line, psz_sdp, linelen);
         line[linelen] = '\0';



More information about the vlc-commits mailing list