Package: screen
Version: 5.0.1-2
Severity: normal
Tags: patch

Dear maintainer,

Running screen on valgrind to resolve another bug, I discovered that
the pollfd sctructs were not initialized.

The attached patch fixes this and silences valgrind.

Regards,


-- Package-specific info:
File Existence and Permissions
------------------------------

drwxr-xr-x 43 root root   1160 May 16 10:38 /run
lrwxrwxrwx  1 root root      4 Aug  9  2015 /var/run -> /run
-rwxr-xr-x  1 root root 482016 May 15 20:00 /usr/bin/screen
-rw-r--r--  1 root root     29 Jun 19  2017 /etc/tmpfiles.d/screen-cleanup.conf
lrwxrwxrwx  1 root root      9 Aug  9  2015 
/lib/systemd/system/screen-cleanup.service -> /dev/null
-rwxr-xr-x  1 root root   1222 Apr  2  2017 /etc/init.d/screen-cleanup
lrwxrwxrwx  1 root root     24 May 29  2018 /etc/rcS.d/S17screen-cleanup -> 
../init.d/screen-cleanup

File contents
-------------

### /etc/tmpfiles.d/screen-cleanup.conf
______________________________________________________________________
d /run/screen 1777 root utmp
______________________________________________________________________

-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 7.0.4+deb14-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages screen depends on:
ii  debianutils  5.23.2
ii  libc6        2.42-16
ii  libpam0g     1.7.0-5+b2
ii  libtinfo6    6.6+20251231-1+b1

screen recommends no packages.

Versions of packages screen suggests:
pn  byobu | screenie | iselect  <none>
ii  ncurses-term                6.6+20251231-1

-- no debconf information
Description: Fixes uninitialized use of pollfd structs in evdeq.
 Found with valgrind.
Author: Daniel Serpell
Forwarded: no
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/sched.c
+++ b/sched.c
@@ -74,8 +74,9 @@
                        i++;
 
        if (i > pfd_cnt) {
+               pfd = realloc(pfd, i * sizeof(struct pollfd));
+               memset(pfd + pfd_cnt, 0, sizeof(struct pollfd) * (i - pfd_cnt));
                pfd_cnt = i;
-               pfd = realloc(pfd, pfd_cnt * sizeof(struct pollfd));
        }
 }
 

Reply via email to