提交 9ae720b4 编写于 作者: M Matt Caswell

Check error return from sysconf in secure memory code

We use the sysconf function to provide details about the page size in the
secure memory code. This function can return -1 on error so we should check
for this before proceeding.
Reviewed-by: NKurt Roeckx <kurt@openssl.org>
上级 ae4d0c8d
......@@ -333,8 +333,18 @@ static int sh_init(size_t size, int minsize)
goto err;
/* Allocate space for heap, and two extra pages as guards */
#ifdef _SC_PAGE_SIZE
pgsize = (size_t)sysconf(_SC_PAGE_SIZE);
#if defined(_SC_PAGE_SIZE) || defined (_SC_PAGESIZE)
{
# if defined(_SC_PAGE_SIZE)
long tmppgsize = sysconf(_SC_PAGE_SIZE);
# else
long tmppgsize = sysconf(_SC_PAGESIZE);
# endif
if (tmppgsize < 1)
pgsize = PAGE_SIZE;
else
pgsize = (size_t)tmppgsize;
}
#else
pgsize = PAGE_SIZE;
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册