Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 libc/stdio/fopen.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c
index 83452407..c6053c21 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -10,6 +10,11 @@ FILE *fopen(const char *restrict filename, const char 
*restrict mode)
        int fd;
        int flags;
 
+       if (filename == NULL) {
+               errno = EFAULT;
+               return 0;
+       }
+
        /* Check for valid initial mode character */
        if (!strchr("rwa", *mode)) {
                errno = EINVAL;
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20190511114024.4928-1-jwkozaczuk%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to