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

Dear Maintainer,

>From b772cf1cdd554f330d521cc9d37105a53d1883ae Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Sun, 7 Mar 2021 16:06:31 +0000
>Subject: [PATCH] kill.c: cast a "long" to "size_t" for a comparison

  "fwrite()" returns a type "size_t", but "len" and "ckh_pattern_size"
are of type "long" (comparison).

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 kill.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kill.c b/kill.c
index 58877de..083ea65 100644
--- a/kill.c
+++ b/kill.c
@@ -682,7 +682,7 @@ next_entry:
                entry.ck_group = (long) ftell(patternf);
                cp++;
                len = strlen(cp) + 1;
-               if (fwrite(cp, sizeof(char), len, patternf) != len)
+               if (fwrite(cp, sizeof(char), len, patternf) != (size_t) len)
                    goto err3;
                flag |= GROUP_REGEXP | GROUP_REGEXP_HDR;
            } else {
@@ -768,7 +768,7 @@ next_entry:
            if (fwrite((char *) &entry, sizeof(entry), 1, compf) != 1)
                goto err3;
 
-           if (fwrite(np, sizeof(char), len, patternf) != len)
+           if (fwrite(np, sizeof(char), len, patternf) != (size_t) len)
                goto err3;
 
            header.ckh_entries++;
@@ -900,7 +900,7 @@ again:
        kill_patterns = newstr(header.ckh_pattern_size);
        fseek(killf, header.ckh_entries * sizeof(entry), 1);
        if (fread(kill_patterns, sizeof(char), (int) header.ckh_pattern_size, 
killf)
-           != header.ckh_pattern_size)
+           != (size_t) header.ckh_pattern_size)
            goto err;
     } else
        kill_patterns = newstr(1);
-- 
2.30.1



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

Kernel: Linux 5.10.9-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