소스 검색

* Fix crash on OpenBSD due to mmap(2) bug.

Bryan Drewery 16 년 전
부모
커밋
9269c6a023
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      doc/UPDATES
  2. 1 1
      src/binary.c

+ 1 - 0
doc/UPDATES

@@ -6,6 +6,7 @@
   * Fix problem of upgrading with uninitialized binaries causing corruption (will kick in on future upgrades)
   * Optimized how some shell operations are executed.
   * Uname checking (and associated emails) have been removed.
+  * Fix crash on OpenBSD due to mmap(2) bug.
 * DNS changes
   * More DNS errors are now handled which fixes some misc DNS issues.
   * DNS now works on servers which tend to only return partial results (fixes #424)

+ 1 - 1
src/binary.c

@@ -180,7 +180,7 @@ bin_checksum(const char *fname, int todo)
       OPENSSL_cleanse(hash, sizeof(hash));
 
     /* Copy everything up to this point into the new binary (including the settings header/prefix) */
-    outmap = (unsigned char*) mmap(0, size, PROT_WRITE, MAP_SHARED, newbin->fd, 0);
+    outmap = (unsigned char*) mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, newbin->fd, 0);
     if ((void*)outmap == MAP_FAILED) goto fatal;
 
     if (lseek(newbin->fd, size - 1, SEEK_SET) == -1) goto fatal;