diff -Nru dc3dd-7.2.646/ChangeLog dc3dd-7.3.1/ChangeLog --- dc3dd-7.2.646/ChangeLog 2012-11-06 14:43:00.000000000 +0000 +++ dc3dd-7.3.1/ChangeLog 2023-04-24 22:15:24.000000000 +0000 @@ -1,3 +1,14 @@ +2023-04-23 Joseph Lininger + + * Fix a minor spelling error. + * Fix a buffer overflow in command line handling. + * Standardize memory handling to guard against future memory management issues. + +2023-03-06 Joseph Lininger + + * Fix code base so dc3dd compiles on systems with glibc 2.28 or later. + * Add new contributing authors in src/dc3dd.c. + 2011-03-02 Richard Cordovano * Added the ability to specify log= and hlog= more than once. diff -Nru dc3dd-7.2.646/configure dc3dd-7.3.1/configure --- dc3dd-7.2.646/configure 2016-04-26 15:38:40.000000000 +0000 +++ dc3dd-7.3.1/configure 2023-04-24 22:15:24.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for dc3dd 7.2.646 +# Generated by GNU Autoconf 2.61 for dc3dd 7.3.1 # # Report bugs to . # @@ -574,8 +574,8 @@ # Identity of this package. PACKAGE_NAME='dc3dd' PACKAGE_TARNAME='dc3dd' -PACKAGE_VERSION='7.2.646' -PACKAGE_STRING='dc3dd 7.2.646' +PACKAGE_VERSION='7.3.1' +PACKAGE_STRING='dc3dd 7.3.1' PACKAGE_BUGREPORT='dc3dd@dc3.mil' ac_unique_file="src/dc3dd.c" @@ -1586,7 +1586,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dc3dd 7.2.646 to adapt to many kinds of systems. +\`configure' configures dc3dd 7.3.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1656,7 +1656,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dc3dd 7.2.646:";; + short | recursive ) echo "Configuration of dc3dd 7.3.1:";; esac cat <<\_ACEOF @@ -1770,7 +1770,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dc3dd configure 7.2.646 +dc3dd configure 7.3.1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1784,7 +1784,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dc3dd $as_me 7.2.646, which was +It was created by dc3dd $as_me 7.3.1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2594,7 +2594,7 @@ # Define the identity of the package. PACKAGE='dc3dd' - VERSION='7.2.646' + VERSION='7.3.1' cat >>confdefs.h <<_ACEOF @@ -64904,7 +64904,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dc3dd $as_me 7.2.646, which was +This file was extended by dc3dd $as_me 7.3.1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -64957,7 +64957,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -dc3dd config.status 7.2.646 +dc3dd config.status 7.3.1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -Nru dc3dd-7.2.646/debian/changelog dc3dd-7.3.1/debian/changelog --- dc3dd-7.2.646/debian/changelog 2022-12-22 03:11:37.000000000 +0000 +++ dc3dd-7.3.1/debian/changelog 2023-06-11 17:13:03.000000000 +0000 @@ -1,3 +1,43 @@ +dc3dd (7.3.1-2) unstable; urgency=medium + + * Team upload. + * Upload to unstable. + + -- Joao Eriberto Mota Filho Sun, 11 Jun 2023 14:13:03 -0300 + +dc3dd (7.3.1-1) experimental; urgency=medium + + * Team upload. + * New upstream version 7.3.1. (Closes: #801872) + * debian/patches/10_fix-spelling-error.patch: removed because the upstream + fixed the source code. Thanks. + * debian/tests/control: created a new test to check #801872. + + -- Joao Eriberto Mota Filho Tue, 25 Apr 2023 18:49:38 -0300 + +dc3dd (7.3.0-1) experimental; urgency=medium + + * Team upload. + * New upstream version 7.3.0. + * debian/control: + - Bumped Standards-Version to 4.6.2. + - Using a secure URI in Homepage field. + * debian/copyright: + - Updated packaging copyright years. + - Updated Upstream field. + - Updated upstream rights. + - Using a secure URI in Source field. + * debian/patches/: + - 10_fix-spelling-error.patch: + ~ Added Forwarded field. + ~ Refreshed. + - 30_fix-FTBFS-with-glibc-2.28.patch: removed because the upstream + applied it to the source code. + * debian/rules: replaced override_dh_installdocs by + execute_before_dh_installdocs. + + -- Joao Eriberto Mota Filho Mon, 20 Mar 2023 10:36:11 -0300 + dc3dd (7.2.646-6) unstable; urgency=medium * Team upload. diff -Nru dc3dd-7.2.646/debian/control dc3dd-7.3.1/debian/control --- dc3dd-7.2.646/debian/control 2022-12-22 03:11:37.000000000 +0000 +++ dc3dd-7.3.1/debian/control 2023-06-11 17:12:45.000000000 +0000 @@ -7,8 +7,8 @@ gperf, help2man, liblocale-gettext-perl -Standards-Version: 4.6.1 -Homepage: http://dc3dd.sf.net +Standards-Version: 4.6.2 +Homepage: https://dc3dd.sf.net Rules-Requires-Root: no Vcs-Git: https://salsa.debian.org/pkg-security-team/dc3dd.git Vcs-Browser: https://salsa.debian.org/pkg-security-team/dc3dd diff -Nru dc3dd-7.2.646/debian/copyright dc3dd-7.3.1/debian/copyright --- dc3dd-7.2.646/debian/copyright 2022-12-22 03:11:37.000000000 +0000 +++ dc3dd-7.3.1/debian/copyright 2023-06-11 17:12:45.000000000 +0000 @@ -1,27 +1,33 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Contact: DoD Cyber Crime Center (DC3) -Source: http://dc3dd.sourceforge.net +Upstream-Contact: https://sourceforge.net/projects/dc3dd/support +Source: https://dc3dd.sourceforge.net Upstream-Name: dc3dd Files: * Copyright: 1985-2011 Free Software Foundation, Inc. 1997-1999 Colin Plumb - 2007-2016 DoD Cyber Crime Center (DC3) + 2000-2005 Pavel Roskin License: GPL-3+ -Files: README.coreutils -Copyright: 1998-2006 Free Software Foundation, Inc. -License: GFDL-1.2+ +Files: build-aux/check.mk +Copyright: 2006-2007 The Vaucanson Group. +License: GPL-2+ Files: lib/atexit.c lib/ftruncate.c -Copyright: ? Mike Stump + lib/memmove.c +Copyright: ? David MacKenzie + ? Mike Stump License: public-domain +Files: README.coreutils +Copyright: 1998-2006 Free Software Foundation, Inc. +License: GFDL-1.2+ + Files: debian/* Copyright: 2011 Christophe Monniez 2011 Julien Valroff - 2014-2022 Joao Eriberto Mota Filho + 2014-2023 Joao Eriberto Mota Filho 2018 Raphaƫl Hertzog 2020 Samuel Henrique License: GPL-2+ @@ -43,15 +49,6 @@ On Debian systems, the complete text of the GNU General Public License version 3 can be found in /usr/share/common-licenses/GPL-3 file. -License: GFDL-1.2+ - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -Comment: - On Debian systems, the complete text of the GNU Free Document License - version 1.2 can be found in /usr/share/common-licenses/GFDL-1.2. - License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,5 +66,14 @@ On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". +License: GFDL-1.2+ + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. +Comment: + On Debian systems, the complete text of the GNU Free Document License + version 1.2 can be found in /usr/share/common-licenses/GFDL-1.2. + License: public-domain This file is in the public domain. diff -Nru dc3dd-7.2.646/debian/patches/10_fix-spelling-error.patch dc3dd-7.3.1/debian/patches/10_fix-spelling-error.patch --- dc3dd-7.2.646/debian/patches/10_fix-spelling-error.patch 2022-12-22 03:11:25.000000000 +0000 +++ dc3dd-7.3.1/debian/patches/10_fix-spelling-error.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Description: fix a spelling error in final binary. -Author: Joao Eriberto Mota Filho -Last-Update: 2016-09-17 -Index: dc3dd/src/dc3dd.c -=================================================================== ---- dc3dd.orig/src/dc3dd.c -+++ dc3dd/src/dc3dd.c -@@ -1974,7 +1974,7 @@ flush_grouped_read_errors(input_t* input - if (input->current_errno_count > 1) - { - report_error(0, input->current_errno, -- _("%"PRIuMAX" occurences while reading %s from sector %"PRIuMAX" to sector %"PRIuMAX" %s"), -+ _("%"PRIuMAX" occurrences while reading %s from sector %"PRIuMAX" to sector %"PRIuMAX" %s"), - input->current_errno_count, - quote(input->current_file->name), - input->current_errno_start_sector, diff -Nru dc3dd-7.2.646/debian/patches/30_fix-FTBFS-with-glibc-2.28.patch dc3dd-7.3.1/debian/patches/30_fix-FTBFS-with-glibc-2.28.patch --- dc3dd-7.2.646/debian/patches/30_fix-FTBFS-with-glibc-2.28.patch 2022-12-22 03:11:25.000000000 +0000 +++ dc3dd-7.3.1/debian/patches/30_fix-FTBFS-with-glibc-2.28.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -Description: fix a FTBFS with glibc 2.28 -Author: mschlenker -Origin: https://aur.archlinux.org/packages/dc3dd/ -Bug-Debian: https://bugs.debian.org/915431 -Forwarded: https://sourceforge.net/p/dc3dd/bugs/19/ -Reviewed-By: Joao Eriberto Mota Filho -Last-Update: 2018-10-17 -Index: dc3dd/lib/fpurge.c -=================================================================== ---- dc3dd.orig/lib/fpurge.c -+++ dc3dd/lib/fpurge.c -@@ -61,7 +61,7 @@ fpurge (FILE *fp) - /* Most systems provide FILE as a struct and the necessary bitmask in - , because they need it for implementing getc() and putc() as - fast macros. */ --# if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - fp->_IO_read_end = fp->_IO_read_ptr; - fp->_IO_write_ptr = fp->_IO_write_base; - /* Avoid memory leak when there is an active ungetc buffer. */ -Index: dc3dd/lib/freadahead.c -=================================================================== ---- dc3dd.orig/lib/freadahead.c -+++ dc3dd/lib/freadahead.c -@@ -24,7 +24,7 @@ - size_t - freadahead (FILE *fp) - { --#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - if (fp->_IO_write_ptr > fp->_IO_write_base) - return 0; - return (fp->_IO_read_end - fp->_IO_read_ptr) -Index: dc3dd/lib/freading.c -=================================================================== ---- dc3dd.orig/lib/freading.c -+++ dc3dd/lib/freading.c -@@ -31,7 +31,7 @@ freading (FILE *fp) - /* Most systems provide FILE as a struct and the necessary bitmask in - , because they need it for implementing getc() and putc() as - fast macros. */ --#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - return ((fp->_flags & _IO_NO_WRITES) != 0 - || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 - && fp->_IO_read_base != NULL)); -Index: dc3dd/lib/freadptr.c -=================================================================== ---- dc3dd.orig/lib/freadptr.c -+++ dc3dd/lib/freadptr.c -@@ -29,7 +29,7 @@ freadptr (FILE *fp, size_t *sizep) - size_t size; - - /* Keep this code in sync with freadahead! */ --#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - if (fp->_IO_write_ptr > fp->_IO_write_base) - return NULL; - size = fp->_IO_read_end - fp->_IO_read_ptr; -Index: dc3dd/lib/freadseek.c -=================================================================== ---- dc3dd.orig/lib/freadseek.c -+++ dc3dd/lib/freadseek.c -@@ -34,7 +34,7 @@ static inline void - freadptrinc (FILE *fp, size_t increment) - { - /* Keep this code in sync with freadptr! */ --#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - fp->_IO_read_ptr += increment; - #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ - fp_->_p += increment; -Index: dc3dd/lib/fseeko.c -=================================================================== ---- dc3dd.orig/lib/fseeko.c -+++ dc3dd/lib/fseeko.c -@@ -44,7 +44,7 @@ rpl_fseeko (FILE *fp, off_t offset, int - #endif - - /* These tests are based on fpurge.c. */ --#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - if (fp->_IO_read_end == fp->_IO_read_ptr - && fp->_IO_write_ptr == fp->_IO_write_base - && fp->_IO_save_base == NULL) -Index: dc3dd/lib/fseterr.c -=================================================================== ---- dc3dd.orig/lib/fseterr.c -+++ dc3dd/lib/fseterr.c -@@ -29,7 +29,7 @@ fseterr (FILE *fp) - /* Most systems provide FILE as a struct and the necessary bitmask in - , because they need it for implementing getc() and putc() as - fast macros. */ --#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ - fp->_flags |= _IO_ERR_SEEN; - #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ - fp_->_flags |= __SERR; -Index: dc3dd/lib/stdio-impl.h -=================================================================== ---- dc3dd.orig/lib/stdio-impl.h -+++ dc3dd/lib/stdio-impl.h -@@ -18,6 +18,13 @@ - the same implementation of stdio extension API, except that some fields - have different naming conventions, or their access requires some casts. */ - -+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this -+ problem by defining it ourselves. FIXME: Do not rely on glibc -+ internals. */ -+ -+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN -+# define _IO_IN_BACKUP 0x100 -+#endif - - /* BSD stdio derived implementations. */ - diff -Nru dc3dd-7.2.646/debian/patches/series dc3dd-7.3.1/debian/patches/series --- dc3dd-7.2.646/debian/patches/series 2022-12-22 03:11:37.000000000 +0000 +++ dc3dd-7.3.1/debian/patches/series 2023-06-11 17:12:45.000000000 +0000 @@ -1,4 +1,2 @@ -10_fix-spelling-error.patch 20_fix-autotools.patch -30_fix-FTBFS-with-glibc-2.28.patch 40_fix-unreproducible-man.patch diff -Nru dc3dd-7.2.646/debian/rules dc3dd-7.3.1/debian/rules --- dc3dd-7.2.646/debian/rules 2022-12-22 03:11:25.000000000 +0000 +++ dc3dd-7.3.1/debian/rules 2023-06-11 17:12:45.000000000 +0000 @@ -12,6 +12,5 @@ [ ! -f Makefile ] || $(MAKE) maintainer-clean dh_clean -override_dh_installdocs: +execute_before_dh_installdocs: make THANKS-to-translators - dh_installdocs diff -Nru dc3dd-7.2.646/debian/tests/control dc3dd-7.3.1/debian/tests/control --- dc3dd-7.2.646/debian/tests/control 2022-12-22 03:11:37.000000000 +0000 +++ dc3dd-7.3.1/debian/tests/control 2023-06-11 17:12:45.000000000 +0000 @@ -1,3 +1,6 @@ Test-Command: dc3dd if=debian/tests/test.txt of=$AUTOPKGTEST_TMP/test2.txt hash=sha512 2>&1 | grep -C 20 969a39bf47; ls $AUTOPKGTEST_TMP -lh | grep -C 10 test2 Restrictions: allow-stderr + +# Test for #801872 +Test-Command: dc3dd `perl -e 'print "A" x 90000'` 2>&1 | egrep 'unrecognized option .AAAAAAAAAAAAA' diff -Nru dc3dd-7.2.646/lib/fpurge.c dc3dd-7.3.1/lib/fpurge.c --- dc3dd-7.2.646/lib/fpurge.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/fpurge.c 2023-03-06 15:11:28.000000000 +0000 @@ -61,7 +61,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -# if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_IO_read_end = fp->_IO_read_ptr; fp->_IO_write_ptr = fp->_IO_write_base; /* Avoid memory leak when there is an active ungetc buffer. */ diff -Nru dc3dd-7.2.646/lib/freadahead.c dc3dd-7.3.1/lib/freadahead.c --- dc3dd-7.2.646/lib/freadahead.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/freadahead.c 2023-03-06 15:11:28.000000000 +0000 @@ -24,7 +24,7 @@ size_t freadahead (FILE *fp) { -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return 0; return (fp->_IO_read_end - fp->_IO_read_ptr) diff -Nru dc3dd-7.2.646/lib/freading.c dc3dd-7.3.1/lib/freading.c --- dc3dd-7.2.646/lib/freading.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/freading.c 2023-03-06 15:11:28.000000000 +0000 @@ -31,7 +31,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return ((fp->_flags & _IO_NO_WRITES) != 0 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 && fp->_IO_read_base != NULL)); diff -Nru dc3dd-7.2.646/lib/freadptr.c dc3dd-7.3.1/lib/freadptr.c --- dc3dd-7.2.646/lib/freadptr.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/freadptr.c 2023-03-06 15:11:28.000000000 +0000 @@ -29,7 +29,7 @@ size_t size; /* Keep this code in sync with freadahead! */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return NULL; size = fp->_IO_read_end - fp->_IO_read_ptr; diff -Nru dc3dd-7.2.646/lib/freadseek.c dc3dd-7.3.1/lib/freadseek.c --- dc3dd-7.2.646/lib/freadseek.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/freadseek.c 2023-03-06 15:11:28.000000000 +0000 @@ -34,7 +34,7 @@ freadptrinc (FILE *fp, size_t increment) { /* Keep this code in sync with freadptr! */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_IO_read_ptr += increment; #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ fp_->_p += increment; diff -Nru dc3dd-7.2.646/lib/fseeko.c dc3dd-7.3.1/lib/fseeko.c --- dc3dd-7.2.646/lib/fseeko.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/fseeko.c 2023-03-06 15:11:28.000000000 +0000 @@ -44,7 +44,7 @@ #endif /* These tests are based on fpurge.c. */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_read_end == fp->_IO_read_ptr && fp->_IO_write_ptr == fp->_IO_write_base && fp->_IO_save_base == NULL) diff -Nru dc3dd-7.2.646/lib/fseterr.c dc3dd-7.3.1/lib/fseterr.c --- dc3dd-7.2.646/lib/fseterr.c 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/fseterr.c 2023-03-06 15:11:28.000000000 +0000 @@ -29,7 +29,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_flags |= _IO_ERR_SEEN; #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ fp_->_flags |= __SERR; diff -Nru dc3dd-7.2.646/lib/stdio-impl.h dc3dd-7.3.1/lib/stdio-impl.h --- dc3dd-7.2.646/lib/stdio-impl.h 2012-11-06 14:42:58.000000000 +0000 +++ dc3dd-7.3.1/lib/stdio-impl.h 2023-03-06 15:11:28.000000000 +0000 @@ -18,6 +18,13 @@ the same implementation of stdio extension API, except that some fields have different naming conventions, or their access requires some casts. */ +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this + problem by defining it ourselves. FIXME: Do not rely on glibc + internals. */ + +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN +# define _IO_IN_BACKUP 0x100 +#endif /* BSD stdio derived implementations. */ diff -Nru dc3dd-7.2.646/man/dc3dd.1 dc3dd-7.3.1/man/dc3dd.1 --- dc3dd-7.2.646/man/dc3dd.1 2012-11-08 09:29:12.000000000 +0000 +++ dc3dd-7.3.1/man/dc3dd.1 2023-04-24 22:15:24.000000000 +0000 @@ -1,12 +1,258 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. -.TH DC3DD "1" "October 2012" "dc3dd 7.2.631" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4. +.TH DC3DD "1" "April 2023" "dc3dd 7.3.1" "User Commands" .SH NAME dc3dd \- convert and copy a file .SH DESCRIPTION .\" Add any additional description here +.PP +\fB\-\-\-\-\-\-\fR +usage: +\fB\-\-\-\-\-\-\fR +.IP +dc3dd [OPTION 1] [OPTION 2] ... [OPTION N] +.IP +*or* +.IP +dc3dd [HELP OPTION] +.IP +where each OPTION is selected from the basic or advanced +options listed below, or HELP OPTION is selected from the +help options listed below. +.PP +\fB\-\-\-\-\-\-\-\-\-\-\-\-\-\-\fR +basic options: +\fB\-\-\-\-\-\-\-\-\-\-\-\-\-\-\fR +.TP +if=DEVICE or FILE +Read input from a device or a file (see note #1 +below for how to read from standard input). This +option can only be used once and cannot be +combined with ifs=, pat=, or tpat=. +.TP +ifs=BASE.FMT +Read input from a set of files with base name +BASE and sequential file name extensions +conforming to the format specifier FMT (see note +#4 below for how to specify FMT). This option +can only be used once and cannot be combined with +if=, pat=, or tpat=. +.TP +of=FILE or DEVICE +Write output to a file or device (see note #2 +below for how to write to standard output). This +option can be used more than once (see note #3 +below for how to generate multiple outputs). +.TP +hof=FILE or DEVICE +Write output to a file or device, hash the +output bytes, and verify by comparing the output +hash(es) to the input hash(es). This option can +be used more than once (see note #3 below for +how to generate multiple outputs). +.TP +ofs=BASE.FMT +Write output to a set of files with base name BASE +and sequential file name extensions generated from +the format specifier FMT (see note #4 below for +how to specify FMT). This option can be used more +than once (see note #3 below for how to generate +multiple outputs). Specify the maximum size of +each file in the set using ofsz=. +.TP +hofs=BASE.FMT +Write output to a set of files with base name BASE +and sequential file name extensions generated from +the format specifier FMT (see note #4 below for +how to specify FMT). Hash the output files and +verify by comparing the output hash(es) to the +input hash(es). This option can be used more than +once (see note #3 below for how to generate +multiple outputs). Specify the maximum size of +each file in the set using ofsz=. +.TP +ofsz=BYTES +Set the maximum size of each file in the sets of +files specified using ofs= or hofs= to +BYTES (see note #5 below). A default value for +this option may be set at compile time using +\fB\-DDEFAULT_OUTPUT_FILE_SIZE\fR followed by the desired +value in BYTES. +.TP +hash=ALGORITHM +Compute an ALGORITHM hash of the input and also +of any outputs specified using hof=, hofs=, +or fhod=, where ALGORITHM is one of md5, sha1, +sha256, or sha512. This option may be used once +for each supported ALGORITHM. Alternatively, +hashing can be activated at compile time using one +or more of \fB\-DDEFAULT_HASH_MD5\fR,\-DDEFAULT_HASH_SHA1, +\fB\-DDEFAULT_HASH_SHA256\fR, and \fB\-DDEFAULT_HASH_SHA512\fR. +.TP +log=FILE +Log I/O statistcs, diagnostics, and total hashes +of input and output to FILE. If hlog= is not +specified, piecewise hashes of multiple file +input and output are also logged to FILE. This +option can be used more than once to generate +multiple logs. +.TP +hlog=FILE +Log total hashes and piecewise hashes to FILE. +This option can be used more than once to generate +multiple logs. +.TP +mlog=FILE +Create hash log that is easier for machine to read +.PP +\fB\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\fR +advanced options: +\fB\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\fR +.TP +fhod=DEVICE +The same as hof=DEVICE, with additional +hashing of the entire output DEVICE. This option +can be used more than once (see note #3 below +for how to generate multiple outputs). +.TP +rec=off +By default, zeros are written to the output(s) in +place of bad sectors when the input is a device. +Use this option to cause the program to instead +exit when a bad sector is encountered. +.TP +wipe=DEVICE +Wipe DEVICE by writing zeros (default) or a +pattern specified by pat= or tpat=. +.TP +hwipe=DEVICE +Wipe DEVICE by writing zeros (default) or a +pattern specified by pat= or tpat=. Verify +DEVICE after writing it by hashing it and +comparing the hash(es) to the input hash(es). +.TP +pat=HEX +Use pattern as input, writing HEX to every byte +of the output. This option can only be used once +and cannot be combined with if=, ifs=, or +tpat=. +.TP +tpat=TEXT +Use text pattern as input, writing the string TEXT +repeatedly to the output. This option can only be +used once and cannot be combined with if=, ifs=, +or pat=. +.TP +cnt=SECTORS +Read only SECTORS input sectors. Must be used +with pat= or tpat= if not using the pattern with +wipe= or hwipe= to wipe a device. +.TP +iskip=SECTORS +Skip SECTORS sectors at start of the input device +or file. +.TP +oskip=SECTORS +Skip SECTORS sectors at start of the output +file. Specifying oskip= automatically +sets app=on. +.TP +app=on +Do not overwrite an output file specified with +of= if it already exists, appending output instead. +.TP +ssz=BYTES +Unconditionally use BYTES (see note #5 below) bytes +for sector size. If ssz= is not specified, +sector size is determined by probing the device; +if the probe fails or the target is not a device, +a sector size of 512 bytes is assumed. +.TP +bufsz=BYTES +Set the size of the internal byte buffers to BYTES +(see note #5 below). This effectively sets the +maximum number of bytes that may be read at a time +from the input. BYTES must be a multiple of sector +size. Use this option to fine\-tune performance. +.TP +verb=on +Activate verbose reporting, where sectors in/out +are reported for each file in sets of files +specified using ifs=, ofs=, or hofs=. +Alternatively, verbose reporting may be activated +at compile time using \fB\-DDEFAULT_VERBOSE_REPORTING\fR. +.TP +nwspc=on +Activate compact reporting, where the use +of white space to divide log output into +logical sections is suppressed. Alternatively, +compact reporting may be activated at compile +time using \fB\-DDEFAULT_COMPACT_REPORTING\fR. +.TP +b10=on +Activate base 10 bytes reporting, where the +progress display reports 1000 bytes instead +of 1024 bytes as 1 KB. Alternatively, base 10 +bytes reporting may be activated at compile +time using \fB\-DDEFAULT_BASE_TEN_BYTES_REPORTING\fR. +.TP +corruptoutput=on +For verification testing and demonstration +purposes, corrupt the output file(s) with extra +bytes so a hash mismatch is guaranteed. +.PP +\fB\-\-\-\-\-\-\-\-\-\-\-\-\-\fR +help options: +\fB\-\-\-\-\-\-\-\-\-\-\-\-\-\fR +.TP +\fB\-\-help\fR +display this help and exit +.TP +\fB\-\-version\fR +output version information and exit +.TP +\fB\-\-flags\fR +display compile\-time flags and exit +.PP +\fB\-\-\-\-\-\-\fR +notes: +\fB\-\-\-\-\-\-\fR +.PP +1. To read from stdin, do not specify if=, ifs=, pat=, or tpat=. +2. To write to stdout, do not specify of=, hof=, ofs=, hofs=, fhod=, +.IP +wipe=, or hwipe=. +.PP +3. To write to multiple outputs specify more than one of of=, hof=, ofs=, +.IP +hofs=, or fhod=, in any combination. +.PP +4. FMT is a pattern for a sequence of file extensions that can be numerical +.IP +starting at zero, numerical starting at one, or alphabetical. Specify FMT +by using a series of zeros, ones, or a's, respectively. The number of +characters used indicates the desired length of the extensions. +For example, a FMT specifier of 0000 indicates four character +numerical extensions starting with 0000. +.SS "5. BYTES may be followed by the following multiplicative suffixes:" +.IP +c (1), w (2), b (512), kB (1000), K (1024), MB (1000*1000), +M (1024*1024), GB (1000*1000*1000), G (1024*1024*1024), and +so on for T, P, E, Z, and Y. +.PP +6. Consider using cnt=, iskip= and oskip= to work around +.IP +unreadable sectors if error recovery fails. +.PP +7. Sending an interrupt (e.g., CTRL+C) to dc3dd will cause +.IP +the program to report the work completed at the time +the interrupt is received and then exit. +.PP +dc3dd completed at 2023\-04\-04 18:08:06 \fB\-0400\fR .SH AUTHOR Written by Paul Rubin, David MacKenzie, Stuart Kemp, -Jesse Kornblum, Andrew Medico, Richard Cordovano, and Justin Lowe. +Jesse Kornblum, Andrew Medico, Richard Cordovano, Justin Lowe, +Frank Westerman, and Joseph Lininger. .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT diff -Nru dc3dd-7.2.646/README dc3dd-7.3.1/README --- dc3dd-7.2.646/README 2012-11-08 09:29:14.000000000 +0000 +++ dc3dd-7.3.1/README 2023-04-24 22:15:24.000000000 +0000 @@ -1,6 +1,6 @@ -dc3dd 7.2.640 -DCCI -2012-10-09 +dc3dd 7.3.1 +DC3/TSD +2013-04-24 Issues: ------- @@ -10,16 +10,7 @@ New Features: ------------- -Log output may be sent to multiple job logs and hash logs. Simply specify -log=LOG and/or hlog=LOG more than once. - -Verification of an image restored to a device larger than the image is now -supported. Specify hof=DEVICE to hash only the bytes dc3dd writes to the -device. Specify fhod=DEVICE to hash both the bytes dc3dd writes to the -device and all the bytes that follow, up to the end of the device. - -Specifying hof=DEVICE will now default to phod=DEVICE behavior (hash only -the bytes output by dc3dd, not the full device). +See the file "ChageLog" for a list of changes between versions. Building dc3dd: --------------- @@ -27,8 +18,8 @@ The default configuration can be built and installed to /usr/local/bin with the following commands: -$ tar zxvf dc3dd-7.2.640.tar.gz -$ cd dc3dd-7.2.640 +$ unzip dc3dd-7.3.1.zip +$ cd dc3dd-7.3.1 $ ./configure $ make $ sudo make install @@ -67,6 +58,8 @@ --enable-hpadco Enable checking ATA/SATA drives for hidden areas No command-line equivalent, cannot be overridden. +WARNING: THIS OPTION IS AVAILABLE, BUT NOT FULLY IMPLEMENTED. SPECIFYING +THIS OPTION WILL CAUSE COMPILATION TO FAIL. These options are enabled by including them in the CFLAGS argument to configure. For example, to enable MD5 hashing and default output file diff -Nru dc3dd-7.2.646/src/dc3dd.c dc3dd-7.3.1/src/dc3dd.c --- dc3dd-7.2.646/src/dc3dd.c 2012-12-03 10:29:48.000000000 +0000 +++ dc3dd-7.3.1/src/dc3dd.c 2023-04-24 22:15:24.000000000 +0000 @@ -67,7 +67,9 @@ proper_name("Jesse Kornblum"), \ proper_name("Andrew Medico"), \ proper_name("Richard Cordovano"), \ - proper_name("Justin Lowe") + proper_name("Justin Lowe"), \ + proper_name("Frank Westerman"), \ + proper_name("Joseph Lininger") // Keep block size smaller than SIZE_MAX - alignment bytes, to allow // allocating buffers that size. Keep block size smaller than SSIZE_MAX, for @@ -401,6 +403,32 @@ void usage(int status); +static void report(const char* message, enum LOGS target); + +static void* +heap_allocate(size_t size) +{ + void* result = malloc(size); + if (result == NULL) + { + report(_("Memory allocation error -- Cannot continue. Program aborted.\n"), ALL_LOGS); + exit(1); + } + return result; +} + +static void* +heap_reallocate(void* ptr, size_t size) +{ + void* result = realloc(ptr, size); + if (result == NULL) + { + report(_("Memory allocation error -- Cannot continue. Program aborted.\n"), ALL_LOGS); + exit(1); + } + return result; +} + static void terminate_logging() { pthread_mutex_lock(&reporting_lock); @@ -525,13 +553,7 @@ if (!use_malloc) wmessage = NULL; - wchar_t *p = (wchar_t *)realloc(wmessage, len * sizeof (wchar_t)); - if (p == NULL) - { - free (wmessage); - fputws_unlocked(L"out of memory\n", stderr); - return; - } + wchar_t *p = (wchar_t *)heap_reallocate(wmessage, len * sizeof (wchar_t)); wmessage = p; use_malloc = true; } @@ -651,7 +673,7 @@ // Put it in string form. const size_t len = 32; // More than enough to hold 'YYYY-MM-DD HH:MM:SS -0000' - char* time_str = (char*)malloc(len); + char* time_str = (char*)heap_allocate(len); if (strftime(time_str, len, "%F %T %z", &tm) == 0) report_error(DC3DD_EXIT_ABORTED, 0, "strftime() returned 0"); @@ -1416,7 +1438,7 @@ size_t fmt_len = strlen(file_ext_fmt); size_t base_len = strlen(base_name); size_t len = base_len + fmt_len + 2; - char* file_name = (char*)malloc(len); + char* file_name = (char*)heap_allocate(len); snprintf(file_name, base_len + 2, "%s.", base_name); // In case starting with .001 @@ -1461,7 +1483,7 @@ char *file_name = part_of_set ? generate_file_name(name, number) : strdup(name); if (file_name) { - file = (file_t*)malloc(sizeof(file_t)); + file = (file_t*)heap_allocate(sizeof(file_t)); file->unparsed_name = strdup(name); file->name = file_name; file->part_of_set = part_of_set; @@ -1660,7 +1682,7 @@ { // The desired skip is not representable as an off_t, so try // doing the skip using read() calls. - char* buffer = (char*)malloc(output->buffer_size); + char* buffer = (char*)heap_allocate(output->buffer_size); while (bytes_to_skip) { size_t bytes_to_read = @@ -1770,10 +1792,10 @@ static hash_t* make_hash(hash_algorithm_t* algorithm) { - hash_t* hash = (hash_t*)malloc(sizeof(hash_t)); - hash->context = malloc(algorithm->context_size); - hash->sum = (char*)malloc(algorithm->sum_size); - hash->result = (char*)malloc(2 * algorithm->sum_size + 1); + hash_t* hash = (hash_t*)heap_allocate(sizeof(hash_t)); + hash->context = heap_allocate(algorithm->context_size); + hash->sum = (char*)heap_allocate(algorithm->sum_size); + hash->result = (char*)heap_allocate(2 * algorithm->sum_size + 1); hash->result[0] = 0; hash->bytes_hashed = 0; hash->next_hash = NULL; @@ -1974,7 +1996,7 @@ if (input->current_errno_count > 1) { report_error(0, input->current_errno, - _("%"PRIuMAX" occurences while reading %s from sector %"PRIuMAX" to sector %"PRIuMAX" %s"), + _("%"PRIuMAX" occurrences while reading %s from sector %"PRIuMAX" to sector %"PRIuMAX" %s"), input->current_errno_count, quote(input->current_file->name), input->current_errno_start_sector, @@ -2990,7 +3012,7 @@ // Set up synchronization for signal handling and kick off the signal handling thread. pthread_mutex_init(&signaling_lock, NULL); - interrupted = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)); + interrupted = (pthread_cond_t*)heap_allocate(sizeof(pthread_cond_t)); pthread_cond_init(interrupted, NULL); pthread_t signal_handling_thread; start_thread(&signal_handling_thread, await_interrupt_signal, NULL); @@ -3017,7 +3039,7 @@ static job_t* make_job(task_t* tasks, void (*report_progress)(job_t*, bool)) { - job_t* job = (job_t*)malloc(sizeof(job_t)); + job_t* job = (job_t*)heap_allocate(sizeof(job_t)); job->tasks = tasks; job->progress_interval_in_ms = JOB_PROGRESS_INTERVAL_MILLISECS; job->report_progress = report_progress; @@ -3029,8 +3051,8 @@ static task_t* make_task(input_t *input, output_t *outputs, file_output_t *verification_target) { - task_t *task = (task_t*)malloc(sizeof(task_t)); - task->signaling_lock = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)); + task_t *task = (task_t*)heap_allocate(sizeof(task_t)); + task->signaling_lock = (pthread_mutex_t*)heap_allocate(sizeof(pthread_mutex_t)); task->input = input; task->outputs = outputs; task->verification_target = verification_target; @@ -3044,24 +3066,24 @@ static buffer_queue_t* make_buffer_queue(size_t size_in_bytes, size_t number_of_buffers) { - buffer_queue_t* buffer_queue = (buffer_queue_t*)malloc(sizeof(buffer_queue_t)); - buffer_queue->buffers = (buffer_t*)malloc(number_of_buffers * sizeof(buffer_t)); + buffer_queue_t* buffer_queue = (buffer_queue_t*)heap_allocate(sizeof(buffer_queue_t)); + buffer_queue->buffers = (buffer_t*)heap_allocate(number_of_buffers * sizeof(buffer_t)); for (size_t i = 0; i < number_of_buffers; ++i) { buffer_queue->buffers[i].length = 0; - buffer_queue->buffers[i].data = (char*)malloc(size_in_bytes * sizeof(char)); + buffer_queue->buffers[i].data = (char*)heap_allocate(size_in_bytes * sizeof(char)); } buffer_queue->number_of_buffers = number_of_buffers; buffer_queue->buffers_used = 0; buffer_queue->next_available_buffer = 0; - buffer_queue->lock = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)); + buffer_queue->lock = (pthread_mutex_t*)heap_allocate(sizeof(pthread_mutex_t)); pthread_mutex_init(buffer_queue->lock, NULL); - buffer_queue->not_empty = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)); + buffer_queue->not_empty = (pthread_cond_t*)heap_allocate(sizeof(pthread_cond_t)); pthread_cond_init(buffer_queue->not_empty, NULL); - buffer_queue->not_full = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)); + buffer_queue->not_full = (pthread_cond_t*)heap_allocate(sizeof(pthread_cond_t)); pthread_cond_init(buffer_queue->not_full, NULL); buffer_queue->done_buffering = false; @@ -3072,7 +3094,7 @@ static output_t* make_output(settings_t* settings) { - output_t* output = (output_t*)malloc(sizeof(output_t)); + output_t* output = (output_t*)heap_allocate(sizeof(output_t)); output->state = PENDING; output->sector_size = settings->sector_size; output->buffer_size = settings->buffer_size; @@ -3108,7 +3130,7 @@ } // Construct the "derived part." - output->file = (file_output_t*)malloc(sizeof(file_output_t)); + output->file = (file_output_t*)heap_allocate(sizeof(file_output_t)); output->file->current_file = file; output->file->files = file->part_of_set ? file : NULL; output->file->max_file_size = settings->max_output_file_size; @@ -3126,7 +3148,7 @@ make_hash_output(settings_t *settings, hash_algorithm_t *algorithm, enum VERIFICATION_TYPE verification) { output_t* output = make_output(settings); - output->hash = (hash_output_t*)malloc(sizeof(hash_output_t)); + output->hash = (hash_output_t*)heap_allocate(sizeof(hash_output_t)); output->hash->algorithm = algorithm; output->hash->total_hash = make_hash(algorithm); output->hash->total_hash_length = INFINITE_BYTES; @@ -3174,7 +3196,7 @@ static input_t* make_input(settings_t* settings) { - input_t* input = (input_t*)malloc(sizeof(input_t)); + input_t* input = (input_t*)heap_allocate(sizeof(input_t)); input->state = PENDING; input->sector_size = settings->sector_size; input->max_sectors_to_input = settings->max_sectors_to_input; @@ -3199,7 +3221,7 @@ // There is no harm in aligning it in either case. input->buffer_size = settings->buffer_size; input->buffer.data = - (char*)malloc((input->buffer_size) + 2 * getpagesize() - 1); + (char*)heap_allocate((input->buffer_size) + 2 * getpagesize() - 1); input->buffer.data = (char*)ptr_align(input->buffer.data, getpagesize()); input->buffer.length = 0; @@ -3450,7 +3472,7 @@ static char *string=NULL; int x, y, z, pos=0; if( string==NULL ) - string = (char *)malloc( sizeof(char *)*66); + string = (char *)heap_allocate( sizeof(char *)*66); for( x=0; x<66; x++) string[x]=0; y=64; @@ -3721,7 +3743,7 @@ if (pattern_template_length != 0 && pattern_template_length % 2 == 0) { *pattern_length = pattern_template_length / 2; - *pattern = (char*)malloc(*pattern_length); + *pattern = (char*)heap_allocate(*pattern_length); for (size_t i = 0; i < *pattern_length; i++) { @@ -4153,7 +4175,7 @@ static settings_t* make_settings() { - settings_t* settings = (settings_t*)malloc(sizeof(settings_t)); + settings_t* settings = (settings_t*)heap_allocate(sizeof(settings_t)); settings->input_pattern_string = NULL; settings->input_pattern = NULL; settings->input_pattern_length = 0; @@ -4286,7 +4308,7 @@ } char* cmdline = NULL; - cmdline = (char*)malloc(len); + cmdline = (char*)heap_allocate(len); char* command_line = cmdline; for (int i = 0; i < argc; ++i) { @@ -4369,14 +4391,21 @@ } // Report the command line. + char* prefix = _("command line"); char* command_line = make_cmd_line_string(argc, argv); - char message[DISPLAY_MESSAGE_LENGTH]; - sprintf(message, _("command line: %s\n"), command_line); + // Allocate memory for the message + // This should be a maximum of: length of prefix, plus a colon, plus a space, plus the length of command_line, plus 2 for possible CRLF, plus 1 for the null + size_t message_length = strlen(prefix) + strlen(command_line) + 5; + char* message = (char*) heap_allocate(message_length); + sprintf(message, "%s %s\n", prefix, command_line); report(message, ALL_LOGS); + free(message); + message = NULL; free(command_line); + command_line = NULL; flush_logs(); } - + static void report_startup_message() { @@ -4416,13 +4445,13 @@ report_error(DC3DD_EXIT_ABORTED, errno, _("opening log %s"), quote(val)); // Add the log to the logs list specified by the caller. - log_t* log = (log_t*)malloc(sizeof(log_t)); + log_t* log = (log_t*)heap_allocate(sizeof(log_t)); log->file = file; log->next_log = NULL; add_to_log_list(logs, log); // Add the log to the master logs list. - log = (log_t*)malloc(sizeof(log_t)); + log = (log_t*)heap_allocate(sizeof(log_t)); log->file = file; log->next_log = NULL; add_to_log_list(&all_logs, log); diff -Nru dc3dd-7.2.646/.version dc3dd-7.3.1/.version --- dc3dd-7.2.646/.version 2016-04-27 08:22:16.000000000 +0000 +++ dc3dd-7.3.1/.version 2023-04-24 22:15:24.000000000 +0000 @@ -1 +1 @@ -7.2.646 +7.3.1 diff -Nru dc3dd-7.2.646/.version.bak dc3dd-7.3.1/.version.bak --- dc3dd-7.2.646/.version.bak 2016-04-26 12:22:30.000000000 +0000 +++ dc3dd-7.3.1/.version.bak 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -7.2.645