diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2014-09-17 18:20:39 +0000 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2014-09-17 18:20:39 +0000 |
commit | 1244d523e3b59dbb8fab7320587f11a9333d33dd (patch) | |
tree | e6324786898eacf6b2795b910d6245eadd63507c | |
parent | ad49c95e264a478eb9af885e0efdf81ea2c6e1ab (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>
-rw-r--r-- | stegmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |