From e66bf564f8a9cdd6378b829915401f36e87351f6 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] ps/output.c: Check return value of mmap() in init_output(). We decided not to check the return value of the mprotect() calls, because they are not vital to the operation of ps. --- ps/output.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ps/output.c b/ps/output.c index 4456f282..01b87658 100644 --- a/ps/output.c +++ b/ps/output.c @@ -2169,6 +2169,9 @@ void init_output(void){ -1, 0 ); + if(outbuf == MAP_FAILED) + catastrophic_failure(__FILE__, __LINE__, _("please report this bug")); + memset(outbuf, ' ', SPACE_AMOUNT); if(SPACE_AMOUNT==page_size) mprotect(outbuf, page_size, PROT_READ); mprotect(outbuf + page_size*outbuf_pages, page_size, PROT_NONE); // guard page