From: Jim Warner Date: Fri, 18 Mar 2022 05:00:00 +0000 (-0500) Subject: top: add more robustness to logic for reading a rcfile X-Git-Tag: v4.0.0~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c356954851d558437bb89fc3f59dafe11023cfb;p=procps-ng top: add more robustness to logic for reading a rcfile At this point I don't know if the Rc.id ever carried a value of 'b', 'c', 'd' or 'e' in a public release. But I do know that those values ought not to be recognized in any configuration file. Now they won't be for sure. [ the net result is that now a user with such a file ] [ will see the 'incompatible rcfile' message instead ] [ of that misleading 'window entry corrupt' message. ] Signed-off-by: Jim Warner --- diff --git a/top/top.c b/top/top.c index 83baab77..2fcd1e13 100644 --- a/top/top.c +++ b/top/top.c @@ -3824,6 +3824,8 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) { } if (Rc.id < 'a' || Rc.id > RCF_VERSION_ID) return p; + if (strchr("bcde", Rc.id)) + return p; if (Rc.mode_altscr < 0 || Rc.mode_altscr > 1) return p; if (Rc.mode_irixps < 0 || Rc.mode_irixps > 1)