From 5218ba983fea53ce02189314e21679b8510ffc37 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Sat, 29 Apr 2000 13:38:05 +0000 Subject: [PATCH] Fix a possible segmentation fault with the external query feature. --- query.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/query.c b/query.c index 439f71d0..ad497465 100644 --- a/query.c +++ b/query.c @@ -92,21 +92,21 @@ static QUERY *run_query (char *s, int quiet) fgets (msg, sizeof (msg) - 1, fp); while (fgets(buf, sizeof (buf) - 1, fp)) { - if (first == NULL) - { - FirstColumn = 0; - SecondColumn = 0; - first = (QUERY *) safe_calloc (1, sizeof (QUERY)); - cur = first; - } - else - { - cur->next = (QUERY *) safe_calloc (1, sizeof (QUERY)); - cur = cur->next; - } - p = strtok(buf, "\t\n"); - if (p) + if ((p = strtok(buf, "\t\n"))) { + if (first == NULL) + { + FirstColumn = 0; + SecondColumn = 0; + first = (QUERY *) safe_calloc (1, sizeof (QUERY)); + cur = first; + } + else + { + cur->next = (QUERY *) safe_calloc (1, sizeof (QUERY)); + cur = cur->next; + } + l = mutt_strlen (p); if (l > SecondColumn) SecondColumn = l; -- 2.40.0