From: Jim Warner Date: Sat, 22 Dec 2012 06:00:00 +0000 (-0600) Subject: pmap avoid SEGV potential with new X/XX detail options X-Git-Tag: v3.3.6~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e8ee148d7a9d46a9130c9edfffa907d7ccfd524;p=procps-ng pmap avoid SEGV potential with new X/XX detail options While permissions suggests that /proc/#/smaps contents are world-readable, in practice this file might not be available to a non-root process. Whether this is a bug in the kernel or an intentional design decision really makes no difference. This commit will protect pmap -X. (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) Reference(s): commit faec340719de6db8f64c468cf1dec84ffdd914a3 Author: Dimitrios Apostolou Date: Thu Sep 27 22:08:04 2012 +1000 Signed-off-by: Jim Warner --- diff --git a/pmap.c b/pmap.c index b33a8fe3..e1773457 100644 --- a/pmap.c +++ b/pmap.c @@ -318,7 +318,7 @@ loop_end: firstmapping = 0; } /* === PRINT TOTALS === */ - if (!q_option) { + if (!q_option && listhead!=NULL) { footer_gap = maxw1+maxw2+maxw3+maxw4+maxw5+5; for (i=0; i