[oe-commits] [openembedded-core] 06/17: inetutils: Fix abort on invalid files

git at git.openembedded.org git at git.openembedded.org
Wed Aug 7 18:43:49 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 0c3a1251a8aec86f3e877130f926a928e5ca2030
Author: Ricardo Ribalda Delgado <ricardo at ribalda.com>
AuthorDate: Wed Aug 7 09:17:44 2019 +0200

    inetutils: Fix abort on invalid files
    
    When the code is compiled with  "-fstack-protector-strong
    -D_FORTIFY_SOURCE=2", everytime ftpfd is asked for a non existent file,
    it crashes with the following error:
    
    *** buffer overflow detected ***:
    Aborted
    
    This seems to be a bug/feature of gcc. A bug has been open on their
    bugzilla, and also inetutils have been posted with the proposed patch.
    
    Without this patch, pxelinux fails to boot because it keeps asking the
    server for the pxelinux.cfg/00-01-02-03-04 and never jumps to /default.
    
    Signed-off-by: Ricardo Ribalda Delgado <ricardo at ribalda.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 .../inetutils/fix-buffer-fortify-tfpt.patch        | 25 ++++++++++++++++++++++
 .../inetutils/inetutils_1.9.4.bb                   |  1 +
 2 files changed, 26 insertions(+)

diff --git a/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch b/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch
new file mode 100644
index 0000000..a91913c
--- /dev/null
+++ b/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch
@@ -0,0 +1,25 @@
+tftpd: Fix abort on error path
+
+When trying to fetch a non existent file, the app crashes with:
+
+*** buffer overflow detected ***: 
+Aborted
+
+
+Upstream-Status: Submitted [https://www.mail-archive.com/bug-inetutils@gnu.org/msg03036.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91205]
+Signed-off-by: Ricardo Ribalda Delgado <ricardo at ribalda.com>
+diff --git a/src/tftpd.c b/src/tftpd.c
+index 56002a0..144012f 100644
+--- a/src/tftpd.c
++++ b/src/tftpd.c
+@@ -864,9 +864,8 @@ nak (int error)
+       pe->e_msg = strerror (error - 100);
+       tp->th_code = EUNDEF;	/* set 'undef' errorcode */
+     }
+-  strcpy (tp->th_msg, pe->e_msg);
+   length = strlen (pe->e_msg);
+-  tp->th_msg[length] = '\0';
++  memcpy(tp->th_msg, pe->e_msg, length + 1);
+   length += 5;
+   if (sendto (peer, buf, length, 0, (struct sockaddr *) &from, fromlen) != length)
+     syslog (LOG_ERR, "nak: %m\n");
diff --git a/meta/recipes-connectivity/inetutils/inetutils_1.9.4.bb b/meta/recipes-connectivity/inetutils/inetutils_1.9.4.bb
index ac2e017..684fbe0 100644
--- a/meta/recipes-connectivity/inetutils/inetutils_1.9.4.bb
+++ b/meta/recipes-connectivity/inetutils/inetutils_1.9.4.bb
@@ -22,6 +22,7 @@ SRC_URI = "${GNU_MIRROR}/inetutils/inetutils-${PV}.tar.gz \
            file://inetutils-1.9-PATH_PROCNET_DEV.patch \
            file://inetutils-only-check-pam_appl.h-when-pam-enabled.patch \
            file://0001-rcp-fix-to-work-with-large-files.patch \
+           file://fix-buffer-fortify-tfpt.patch \
 "
 
 SRC_URI[md5sum] = "04852c26c47cc8c6b825f2b74f191f52"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list