summaryrefslogtreecommitdiff
path: root/stegmp.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2014-09-17 18:20:39 +0000
committerOlivier Gayot <duskcoder@gmail.com>2014-09-17 18:20:39 +0000
commit1244d523e3b59dbb8fab7320587f11a9333d33dd (patch)
treee6324786898eacf6b2795b910d6245eadd63507c /stegmp.c
parentad49c95e264a478eb9af885e0efdf81ea2c6e1ab (diff)
reader: do not map the pages as writable
it is somehow insecure and useless to map the pages of the bitmap as writable if we only want to read data from it. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'stegmp.c')
-rw-r--r--stegmp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stegmp.c b/stegmp.c
index c80075c..6584e81 100644
--- a/stegmp.c
+++ b/stegmp.c
@@ -151,8 +151,8 @@ static int stegmp(const char *bmp_file, FILE *input)
}
fstat(fileno(fh), &stat);
- addr = mmap(NULL, stat.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
- fileno(fh), 0);
+ addr = mmap(NULL, stat.st_size, PROT_READ | ((input) ? PROT_WRITE : 0),
+ MAP_PRIVATE, fileno(fh), 0);
if (addr == MAP_FAILED) {
fprintf(stderr, "%s: %m\n", bmp_file);