From a617461c630da22f4bcc22c687f5a299b5630e2d Mon Sep 17 00:00:00 2001
From: Ralph Little <skelband@gmail.com>
Date: Mon, 2 Oct 2023 16:40:27 -0700
Subject: [PATCH] sanei_config: malformed line can return NULL for token. We
 should check.

---
 sanei/sanei_config.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sanei/sanei_config.c b/sanei/sanei_config.c
index 07c85c964..45f380337 100644
--- a/sanei/sanei_config.c
+++ b/sanei/sanei_config.c
@@ -295,6 +295,12 @@ sanei_configure_attach (const char *config_file, SANEI_Config * config,
        * So we parse the line 2 time to find an option */
       /* check if it is an option */
       lp = sanei_config_get_string (lp, &token);
+      if (NULL == token)
+        {
+          // Invalid format?
+          continue;
+        }
+
       if (strncmp (token, "option", 6) == 0)
 	{
 	  /* skip the "option" token */
-- 
GitLab

