summaryrefslogtreecommitdiffstats
path: root/external/poky/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-11-02 11:07:33 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-11-02 11:07:33 +0900
commit1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch)
treecd70a267a5ef105ba32f200aa088e281fbd85747 /external/poky/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch
parent4204309872da5cb401cbb2729d9e2d4869a87f42 (diff)
recipes
Diffstat (limited to 'external/poky/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch')
-rw-r--r--external/poky/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/external/poky/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch b/external/poky/meta/recipes-connectivity/inetutils/inetutils/fix-buffer-fortify-tfpt.patch
new file mode 100644
index 00000000..a91913cb
--- /dev/null
+++ b/external/poky/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@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");