diff --git a/tftp-off-by-one.patch b/tftp-off-by-one.patch new file mode 100644 index 0000000..98b0874 --- /dev/null +++ b/tftp-off-by-one.patch @@ -0,0 +1,44 @@ +Resolves: #1485943 + +--- a/tftpd/tftpd.c 2017-08-28 09:12:11.681299000 +0200 ++++ b/tftpd/tftpd.c 2017-08-28 13:30:03.109312000 +0200 +@@ -1388,24 +1388,25 @@ + return strlen(p); + + case 'x': +- if (output) { +- if (from.sa.sa_family == AF_INET) { ++ if (from.sa.sa_family == AF_INET) { ++ if (output) { + sprintf(output, "%08lX", + (unsigned long)ntohl(from.si.sin_addr.s_addr)); +- l = 8; ++ } ++ l = 8; + #ifdef HAVE_IPV6 +- } else { +- unsigned char *c = (unsigned char *)SOCKADDR_P(&from); +- p = tb; +- for (l = 0; l < 16; l++) { +- sprintf(p, "%02X", *c); +- c++; +- p += 2; +- } ++ } else { ++ unsigned char *c = (unsigned char *)SOCKADDR_P(&from); ++ p = tb; ++ for (l = 0; l < 16; l++) { ++ sprintf(p, "%02X", *c); ++ c++; ++ p += 2; ++ } ++ if (output) + strcpy(output, tb); +- l = strlen(tb); ++ l = strlen(tb); + #endif +- } + } + return l; + + diff --git a/tftp.spec b/tftp.spec index c126931..6ec19ab 100644 --- a/tftp.spec +++ b/tftp.spec @@ -22,6 +22,7 @@ Patch8: tftp-hpa-5.2-pktinfo.patch Patch9: tftp-doc.patch Patch10: tftp-enhanced-logging.patch Patch11: tftp-hpa-5.2-gcc10.patch +Patch12: tftp-off-by-one.patch BuildRequires: make BuildRequires: gcc @@ -61,6 +62,7 @@ systemd socket activation, and is disabled by default. %patch9 -p1 -b .doc %patch10 -p1 -b .logging %patch11 -p1 -b .gcc10 +%patch12 -p1 -b .off-by-one %build autoreconf @@ -105,6 +107,8 @@ install -p -m 644 %SOURCE2 ${RPM_BUILD_ROOT}%{_unitdir} %changelog * Tue Mar 29 2022 Dominik Mierzejewski - 5.2-33 - fix the --mapfile/--map-file discrepancy in the manual page (Lukáš Zaoral) +- fix off-by-one reads and writes when filename remapping with macro \x is used + (Lukáš Zaoral) * Wed Jan 27 2021 Fedora Release Engineering - 5.2-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild