[vlc-commits] misc: securetransport: Check malloc result
Marvin Scholz
git at videolan.org
Tue Jun 26 00:00:03 CEST 2018
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Mon Jun 25 23:55:47 2018 +0200| [c4113a976cbf5dd7125d26fa3a503e2df9b9a1b3] | committer: Marvin Scholz
misc: securetransport: Check malloc result
Add a check for the malloc result to prevent passing NULL to
CFStringGetCString.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c4113a976cbf5dd7125d26fa3a503e2df9b9a1b3
---
modules/misc/securetransport.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/misc/securetransport.c b/modules/misc/securetransport.c
index 7bf8e9e566..4cafc30d3a 100644
--- a/modules/misc/securetransport.c
+++ b/modules/misc/securetransport.c
@@ -93,6 +93,12 @@ static char* CFStringCopyASCIICString(CFStringRef cfString)
maxSize++;
char *buffer = (char *)malloc(maxSize);
+
+ if (unlikely(buffer == NULL)) {
+ return NULL;
+ }
+
+ // Copy CFString in requested encoding to buffer
Boolean success = CFStringGetCString(cfString, buffer, maxSize, kCFStringEncodingASCII);
if (!success)
More information about the vlc-commits
mailing list