]> granicus.if.org Git - procps-ng/commitdiff
pmap: Fix parsing error in config_read().
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Fri, 18 May 2018 21:32:22 +0000 (07:32 +1000)
$ echo '[' > crash
$ pmap -C crash $$
Segmentation fault (core dumped)

pmap.c

diff --git a/pmap.c b/pmap.c
index ea1f46d7f16308230c35cc7abc298691d23f1ce5..9d78d2f4b04edac013898e725842016d21793bac 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -832,7 +832,7 @@ static int config_read (char *rc_filename)
                                trimmed += SECTION_STR_MAPPING_LEN;
                                section_id = SECTION_ID_MAPPING;
                        } else {
-                               while (*trimmed != ']' || *trimmed == '\0') trimmed++;
+                               while (*trimmed != ']' && *trimmed != '\0') trimmed++;
                                if (*trimmed == ']') {
                                        section_id = SECTION_ID_UNSUPPORTED;
                                        xwarnx(_("unsupported section found in the config - line %d"), line_cnt);