We can still directly call _mprotect_readwrite() instead of the high-level function.

This commit is contained in:
Frank Denis 2014-12-07 14:59:32 -08:00
parent 5e364632e0
commit b1cac74b00

View File

@ -429,14 +429,14 @@ sodium_free(void *ptr)
return;
}
canary_ptr = ((unsigned char *) ptr) - sizeof canary;
sodium_mprotect_readwrite(ptr);
if (sodium_memcmp(canary_ptr, canary, sizeof canary) != 0) {
_out_of_bounds();
}
unprotected_ptr = _unprotected_ptr_from_user_ptr(ptr);
base_ptr = unprotected_ptr - page_size * 2U;
memcpy(&unprotected_size, base_ptr, sizeof unprotected_size);
total_size = page_size + page_size + unprotected_size + page_size;
_mprotect_readwrite(base_ptr, total_size);
if (sodium_memcmp(canary_ptr, canary, sizeof canary) != 0) {
_out_of_bounds();
}
#ifndef HAVE_PAGE_PROTECTION
if (sodium_memcmp(unprotected_ptr + unprotected_size,
canary, sizeof canary) != 0) {