[vlc-commits] Revert "service_discovery: sap: fix potential invalid write."
Jean-Baptiste Kempf
git at videolan.org
Sat Dec 6 18:41:40 CET 2014
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Dec 6 18:41:35 2014 +0100| [2ab3f7eb9bb9b6b34e17dfbaefd3cb0bc033aeab] | committer: Jean-Baptiste Kempf
Revert "service_discovery: sap: fix potential invalid write."
This reverts commit 85b463d526df220ffb347ae7cf3475b86392195b.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ab3f7eb9bb9b6b34e17dfbaefd3cb0bc033aeab
---
modules/services_discovery/sap.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index ce6e9fa..8888215 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -1184,7 +1184,6 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
socklen_t glob_len = 0;
unsigned glob_count = 1;
int port = 0;
- char *line = NULL;
/* TODO: use iconv and charset attribute instead of EnsureUTF8 */
while (*psz_sdp)
@@ -1192,19 +1191,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
/* Extract one line */
char *eol = strchr (psz_sdp, '\n');
size_t linelen = eol ? (size_t)(eol - psz_sdp) : strlen (psz_sdp);
-
- if (linelen == SIZE_MAX)
- {
- msg_Warn (p_obj, "overly long line.");
- goto error;
- }
-
- char *line = malloc(linelen + 1);
- if (!line)
- {
- goto error;
- }
-
+ char line[linelen + 1];
memcpy (line, psz_sdp, linelen);
line[linelen] = '\0';
@@ -1471,14 +1458,10 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
}
}
- if(line)
- free(line);
return p_sdp;
error:
FreeSDP (p_sdp);
- if(line)
- free(line);
return NULL;
}
More information about the vlc-commits
mailing list