[vlc-commits] file: check that FD is in valid range
Rémi Denis-Courmont
git at videolan.org
Sat Oct 10 10:17:23 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 10 10:55:41 2020 +0300| [95c234aa9ac55eea62d79ce46b7e6835173fbabc] | committer: Rémi Denis-Courmont
file: check that FD is in valid range
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=95c234aa9ac55eea62d79ce46b7e6835173fbabc
---
modules/access/file.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/access/file.c b/modules/access/file.c
index d37ac28446..e5fa362040 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include <errno.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -142,9 +143,11 @@ int FileOpen( vlc_object_t *p_this )
if (!strcasecmp (p_access->psz_name, "fd"))
{
char *end;
- int oldfd = strtol (p_access->psz_location, &end, 10);
+ unsigned long oldfd = strtoul(p_access->psz_location, &end, 10);
- if (*end == '\0')
+ if (oldfd > INT_MAX)
+ errno = EBADF;
+ else if (*end == '\0')
fd = vlc_dup (oldfd);
else if (*end == '/' && end > p_access->psz_location)
{
More information about the vlc-commits
mailing list