Your message dated Sat, 13 Apr 2019 04:03:41 +0000
with message-id <[email protected]>
and subject line Bug#924059: fixed in runit 2.1.2-29
has caused the Debian Bug report #924059,
regarding runit: resource leaks and issues reported by infer
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
924059: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=924059
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: runit
Severity: normal
Tags: patch



-- System Information:
Distributor ID: Devuan
Description:    Devuan GNU/Linux beowulf/ceres
Release:        10
Codename:       n/a
Architecture: x86_64

Kernel: Linux 5.0.0 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)

>From 62031255f6e7f6ef0355c81010bb193153267485 Mon Sep 17 00:00:00 2001
From: Jan <[email protected]>
Date: Fri, 8 Mar 2019 21:18:35 +0100
Subject: [PATCH] fix: resource leaks and other issues as reported by infer

 to run infer static code analyzer (fbinfer.com):
 cd src; infer run -- make

 - fix: fd_move.c resource leak - close file handle
 - fix: runit-init.c resource leak - close file handle
 - fix: svlogd.c dead storage - value never used
 - fix: x86cpuid.c uninitialized value read
 - fix: package/install-man - do not use unreliable symlinks
---
 runit-2.1.2/package/install-man | 11 +++--------
 runit-2.1.2/src/fd_move.c       |  5 ++++-
 runit-2.1.2/src/runit-init.c    |  6 +++---
 runit-2.1.2/src/svlogd.c        |  2 +-
 runit-2.1.2/src/x86cpuid.c      |  4 ++++
 5 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/runit-2.1.2/package/install-man b/runit-2.1.2/package/install-man
index cd49048..596104e 100755
--- a/runit-2.1.2/package/install-man
+++ b/runit-2.1.2/package/install-man
@@ -1,26 +1,21 @@
 #!/bin/sh
-set -e
 
 umask 022
 test -d package || sh -cx '! : Wrong working directory.'
 test -d man || sh -cx '! : Wrong working directory.'
 
-here=`env - PATH=$PATH pwd`
-parent=`dirname $here`
-
 echo 'Compressing manpages...'
 for i in man/*.[1-8]; do
   gzip -c $i >${i}.gz
 done
 
-echo 'Making manpage links in /usr/local/man...'
+echo 'Installing into /usr/local/man...'
 cd man
 for i in 8; do
   mkdir -p /usr/local/man/man$i
   for j in *.$i; do
-    rm -f /usr/local/man/man$i/$j.gz'{new}'
-    ln -s $parent/runit/man/$j.gz /usr/local/man/man$i/$j.gz'{new}'
-    mv -f /usr/local/man/man$i/$j.gz'{new}' /usr/local/man/man$i/$j.gz
+    mv -uv $j.gz /usr/local/man/man$i/$j.gz
+    rm -f $j.gz
   done
 done
 cd ..
diff --git a/runit-2.1.2/src/fd_move.c b/runit-2.1.2/src/fd_move.c
index 49f723f..8f7420b 100644
--- a/runit-2.1.2/src/fd_move.c
+++ b/runit-2.1.2/src/fd_move.c
@@ -6,7 +6,10 @@
 int fd_move(int to,int from)
 {
   if (to == from) return 0;
-  if (fd_copy(to,from) == -1) return -1;
+  if (fd_copy(to,from) == -1) {
+    close(from);
+    return -1;
+  }
   close(from);
   return 0;
 }
diff --git a/runit-2.1.2/src/runit-init.c b/runit-2.1.2/src/runit-init.c
index 00dc3c9..8a966df 100644
--- a/runit-2.1.2/src/runit-init.c
+++ b/runit-2.1.2/src/runit-init.c
@@ -17,7 +17,7 @@ const char *progname;
 void usage(void) { strerr_die4x(0, "usage: ", progname, USAGE, "\n"); }
 
 void runit_halt () {
-  if (open_trunc(STOPIT) == -1)
+  if (close(open_trunc(STOPIT)) == -1)
     strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
   if (chmod(STOPIT, 0100) == -1)
     strerr_die4sys(111, FATAL, "unable to chmod ", STOPIT, ": ");
@@ -29,11 +29,11 @@ void runit_halt () {
 }
 
 void runit_reboot () {
-  if (open_trunc(STOPIT) == -1)
+  if (close(open_trunc(STOPIT)) == -1)
     strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
   if (chmod(STOPIT, 0100) == -1)
     strerr_die4sys(111, FATAL, "unable to chmod ", STOPIT, ": ");
-  if (open_trunc(REBOOT) == -1)
+  if (close(open_trunc(REBOOT)) == -1)
     strerr_die4sys(111, FATAL, "unable to create ", REBOOT, ": ");
   if (chmod(REBOOT, 0100) == -1)
     strerr_die4sys(111, FATAL, "unable to chmod ", REBOOT, ": ");
diff --git a/runit-2.1.2/src/svlogd.c b/runit-2.1.2/src/svlogd.c
index f433669..09ab402 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -407,7 +407,7 @@ unsigned int ip4_scan(const char *s,char ip[4])
   ++s; ++len;
   i = scan_ulong(s,&u);
   if (!i) return 0;
-  ip[3] = u; s += i; len += i;
+  ip[3] = u; len += i;
   return len;
 }
 
diff --git a/runit-2.1.2/src/x86cpuid.c b/runit-2.1.2/src/x86cpuid.c
index f81c593..ee9ab40 100644
--- a/runit-2.1.2/src/x86cpuid.c
+++ b/runit-2.1.2/src/x86cpuid.c
@@ -21,6 +21,10 @@ int main()
   x[1] = 0;
   x[2] = 0;
   x[3] = 0;
+  y[0] = 0;
+  y[1] = 0;
+  y[2] = 0;
+  y[3] = 0;
 
   asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
   if (!x[0]) return 0;
-- 
2.20.1


--- End Message ---
--- Begin Message ---
Source: runit
Source-Version: 2.1.2-29

We believe that the bug you reported is fixed in the latest version of
runit, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Dmitry Bogatov <[email protected]> (supplier of updated runit package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 13 Apr 2019 03:34:59 +0000
Source: runit
Architecture: source
Version: 2.1.2-29
Distribution: experimental
Urgency: medium
Maintainer: Dmitry Bogatov <[email protected]>
Changed-By: Dmitry Bogatov <[email protected]>
Closes: 916973 924054 924056 924057 924058 924059 924688 924769 926777
Changes:
 runit (2.1.2-29) experimental; urgency=medium
 .
   * [2c5a162f] Apply patches to fix compiler warnings.
     Thanks to Jan <[email protected]>
     (Closes: #924054, #924056, #924057, #924058, #924059)
   * [a76ab7a7] Fix typo in bugnumber in previous changelog entry
   * [f2293d92] Move binaries from runit-init package (Closes: #926777)
   * [a1eed2c8] Make /etc/service point to `current' symlink.
     Thanks to Lorenzo Puliti <[email protected]> (Closes: #916973)
   * [cc656ec6] Bump standards version to 4.3.0
 .
 runit (2.1.2-28) experimental; urgency=medium
 .
   * Change the supervise directory path of update-service to be consistent
     with the path used in dh-runit. (Closes: #924688)
   * Stop init.d script in invoke-run(5) (Closes: #924769)
Checksums-Sha1:
 10c539fc8bdee10e68057a1415276e2af5c71273 2152 runit_2.1.2-29.dsc
 1ffaf83721b0461340876c79a20cdba6a62fe673 35636 runit_2.1.2-29.debian.tar.xz
 f15a23fea6085d1eaffe32c66cb75bdd4bfbdcc0 5348 runit_2.1.2-29_source.buildinfo
Checksums-Sha256:
 027dcae24a2c082d369eec2157186a613bbbad2bc39c23c26fa505931d4f4b53 2152 
runit_2.1.2-29.dsc
 167addfd279f7f498711830a10b8ebf6c2d99945f4e2b44004dc05dcc05a75a6 35636 
runit_2.1.2-29.debian.tar.xz
 aed20522269c0f973123feafd19eed01461a5ff242a858e31ab0487bedbcd9c3 5348 
runit_2.1.2-29_source.buildinfo
Files:
 1110d418e4238bd0ca6fd049759a10ef 2152 admin optional runit_2.1.2-29.dsc
 fc628cc0424e9e5f1fe815ca0d4f71f2 35636 admin optional 
runit_2.1.2-29.debian.tar.xz
 3d5fd12a4f3e87a76437019109df64ce 5348 admin optional 
runit_2.1.2-29_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCgAxFiEEhnHVzDbtdH7ktKj4SBLY3qgmEeYFAlyxWhYTHGthY3Rpb25A
ZGViaWFuLm9yZwAKCRBIEtjeqCYR5gZxEACF4tXJY46+SQll1Fz/jZsXmWgTpksW
Py+jkmCW7VoCDNde/iVCw/2O5b/DeLWO5gKiEoiPYECLAbzln6Tne1FeQTFgnqQm
S856r2/I8uO8z458WOFq824RXjsljaAsjm30DHQ9PmsrZBUQixE+MCHKWqDiy45A
szvl2GSgwSLcTLu+oUKF75dNR2Jl0GZrLK1dWveyXHJInmM1dudfUYCFcw0bPZcP
0rAlffqCktwQB9NGJpLgFaXdjonulyaK6GLavrGb0XYQ2oKRUi5ck4f26PcnW8Ah
2W5i408GYoS7Yhk1WPWZ1U5dh/FmJu8fES+5ZZ14Dw0lAJ0Uq3K+Uxk8C8xl7kXl
xVUHD2SgvCvU/VanXw1Xk/+61KDsdIBNekjgRNESOSXoPajnaEp34kKKYIwDYkRQ
4k0cN6mYKPtEkwNQYGsnvDqNqbz9XUD5Krhw1H9nhcjixh23RyifrT3ooWcfufL/
Zovtx3OZ2s7WSpS+yxUejq0SdfYKIuFt//AUT9MPheBaJhFljjwkf/9bNOI/qaRu
YuIUhOLp6aGgVeEAoOeFPbRKHcM0s61CG/outpi/wQ2nrJsTa2h7Q2yPAR36SoNi
gjEuftM7+8O1GpYucfikc/NiAiiuSmD7J5DKRRGikh5cxKoE7fePto7cnGZ1C8CD
CugiJXG34vxBUQ==
=YS+8
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to