From 7e8ee148d7a9d46a9130c9edfffa907d7ccfd524 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sat, 22 Dec 2012 00:00:00 -0600 Subject: [PATCH] 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 --- pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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