From 1244d523e3b59dbb8fab7320587f11a9333d33dd Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 17 Sep 2014 18:20:39 +0000 Subject: 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 --- stegmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stegmp.c') 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); -- cgit v1.2.3