Here is a patch to fix the issue.
diff --git a/debian/changelog b/debian/changelog index 1b35ca7..fe8f1a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +tcpdump (4.99.4-5) unstable; urgency=medium + + * d/p/drop-privs-only-if-non-root.diff: + - Check if username is set with chown_flag (closes #1078771) + + -- Rodney Dawes <do...@ubuntu.com> Thu, 15 Aug 2024 16:57:37 -0400 + tcpdump (4.99.4-4) unstable; urgency=medium * debian/watch: switch to .tar.xz URLs as upstream homepage no longer diff --git a/debian/patches/drop-privs-after-opening-savefile.diff b/debian/patches/drop-privs-after-opening-savefile.diff index a4c856a..43268f7 100644 --- a/debian/patches/drop-privs-after-opening-savefile.diff +++ b/debian/patches/drop-privs-after-opening-savefile.diff @@ -72,7 +72,7 @@ Origin: https://src.fedoraproject.org/rpms/tcpdump/raw/master/f/0003-Drop-root-p error("%s", pcap_geterr(pd)); + + /* Change ownership of file and drop root privileges */ -+ if (chown_flag) { ++ if (chown_flag && username) { + struct passwd *pwd; + + pwd = getpwnam(username);