Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From c91bc29f6ddf5ba18b9e642b3575fa7ddc651dd4 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Fri, 2 Apr 2021 00:35:55 +0000
>Subject: [PATCH] folder.c: add code for the case "cur_grp = NULL"

  The compiler option "-fanalyzer" shows:

folder.c: In function 'expand_file_name':
folder.c:177:17: warning: use of NULL 'cur_grp' where non-null expected 
[CWE-690] [-Wanalyzer-null-argument]
  177 |       if ((cp = strrchr(cur_grp, '.')))
      |                 ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 folder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/folder.c b/folder.c
index 1a095be..70d0033 100644
--- a/folder.c
+++ b/folder.c
@@ -174,7 +174,7 @@ expand_file_name(char *dest, char *src, int expand_mode)
                    cp = cur_grp;
                    break;
                case 'L':
-                   if ((cp = strrchr(cur_grp, '.')))
+                   if ((cur_grp != NULL) && (cp = strrchr(cur_grp, '.')))
                        cp++;
                    else
                        cp = cur_grp;
-- 
2.30.2



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.24-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to