From 7b44689c8ee776c351c65793b5b94538dfcddd21 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 5 Feb 2023 00:56:16 +0100 Subject: [PATCH] parser: fix char-not-found checks in import-csv.c These were two weird and clearly wrong constructs of the type "if (iter && iter + 1)", where iter is a pointer. This is always true at best and undefined at worst. Another instance was removed in 096de0efd01e. The original code probably wanted to check whether the found character was the last character in the string. But that likewise seems to make no particular sense in this context. Therefore, just remove the second part of the boolean expression. Signed-off-by: Berthold Stoeger --- core/import-csv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/import-csv.c b/core/import-csv.c index 8567f263e..b23b13005 100644 --- a/core/import-csv.c +++ b/core/import-csv.c @@ -178,7 +178,7 @@ static int parse_dan_format(const char *filename, struct xml_params *params, str memset(tmpbuf, 0, sizeof(tmpbuf)); iter = strchr(iter, '|'); - if (iter && iter[1]) { + if (iter) { iter = iter + 1; iter_end = strchr(iter, '|'); @@ -203,7 +203,7 @@ static int parse_dan_format(const char *filename, struct xml_params *params, str for (i = 0; i < 5 && iter; ++i) iter = strchr(iter + 1, '|'); - if (iter && iter + 1) { + if (iter) { iter = iter + 1; iter_end = strchr(iter, '|'); @@ -254,7 +254,7 @@ static int parse_dan_format(const char *filename, struct xml_params *params, str for (i = 0; i < 5 && iter; ++i) iter = strchr(iter + 1, '|'); - if (iter && iter + 1) { + if (iter) { iter = iter + 1; iter_end = strchr(iter, '|');