]> granicus.if.org Git - procps-ng/commitdiff
0056-ps/output.c: Check return value of mmap() in init_output().
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Sat, 9 Jun 2018 11:45:38 +0000 (21:45 +1000)
We decided not to check the return value of the mprotect() calls,
because they are not vital to the operation of ps.

---------------------------- adapted for newlib branch
. many formatting/whitespace differences

Signed-off-by: Jim Warner <james.warner@comcast.net>
ps/output.c

index 3e1bf2e8eb14061b758d0765ceb48df733060313..b1df1fdbdc355002097f83607608a03e168074d5 100644 (file)
@@ -2076,6 +2076,10 @@ void init_output(void)
            MAP_PRIVATE | MAP_ANONYMOUS,
            -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);