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

Dear Maintainer,

>From dd06fa4749ec094ae075d192f966f38bc929e6a6 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <[email protected]>
>Date: Thu, 1 Apr 2021 01:46:00 +0000
>Subject: [PATCH] proto.c: Don't call "unlink()" with a "NULL" as an argument

  Shown by the "-fanalyzer" option:

proto.c:190:5: warning: use of NULL 'lock' where non-null expected [CWE-690] 
[-Wanalyzer-null-argument]
  190 |     unlink(lock);
...
In file included from proto.c:14:
/usr/include/unistd.h:825:12: note: argument 1 of 'unlink' must be non-null
  825 | extern int unlink (const char *__name) __THROW __nonnull ((1));
      |            ^~~~~~

Signed-off-by: Bjarni Ingi Gislason <[email protected]>
---
 proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proto.c b/proto.c
index 3a9e256..5e862c2 100644
--- a/proto.c
+++ b/proto.c
@@ -187,7 +187,7 @@ again:
     /* wrong owner, ie. neither master or expire, so remove it */
 
 rm_lock:
-    unlink(lock);
+    if (lock != NULL) unlink(lock);
 
 no_lock:
     if (command != PL_SET && command != PL_SET_QUICK && command != PL_SET_WAIT)
-- 
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