summaryrefslogtreecommitdiff
path: root/mmap
diff options
context:
space:
mode:
authorSander Striker <striker@apache.org>2003-03-06 12:21:17 +0000
committerSander Striker <striker@apache.org>2003-03-06 12:21:17 +0000
commitbe8e4aa9982c5e91df20bc71c061fd58fb06eab2 (patch)
tree832c878fdacb0411cf71a7d69d532b4015ebc566 /mmap
parent815546d56cb3b8ec66d5be83cf932f48f99dfdc5 (diff)
downloadapr-be8e4aa9982c5e91df20bc71c061fd58fb06eab2.tar.gz
Consistently fail on all platforms.
* mmap/unix/mmap.c (apr_mmap_create): return APR_EINVAL when size == 0. * mmap/win32/mmap.c (apr_mmap_create): return APR_EINVAL when size == 0. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64403 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'mmap')
-rw-r--r--mmap/unix/mmap.c3
-rw-r--r--mmap/win32/mmap.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/mmap/unix/mmap.c b/mmap/unix/mmap.c
index e557f615d..2503f5438 100644
--- a/mmap/unix/mmap.c
+++ b/mmap/unix/mmap.c
@@ -122,6 +122,9 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new,
apr_int32_t native_flags = 0;
#endif
+ if (size == 0)
+ return APR_EINVAL;
+
if (file == NULL || file->filedes == -1 || file->buffered)
return APR_EBADF;
(*new) = (apr_mmap_t *)apr_pcalloc(cont, sizeof(apr_mmap_t));
diff --git a/mmap/win32/mmap.c b/mmap/win32/mmap.c
index 993ef5fbf..b8380d5cb 100644
--- a/mmap/win32/mmap.c
+++ b/mmap/win32/mmap.c
@@ -114,6 +114,9 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file,
DWORD offlo;
DWORD offhi;
+ if (size == 0)
+ return APR_EINVAL;
+
if (flag & APR_MMAP_WRITE)
fmaccess |= PAGE_READWRITE;
else if (flag & APR_MMAP_READ)