From 37ac880897b0d53bfe2bfbfc1e03078039ec9846 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Fri, 25 Apr 2025 01:21:57 +0300 Subject: [PATCH] Applying Arch Linux Patch https://gitlab.archlinux.org/archlinux/packaging/packages/tftp-hpa/-/blob/a70146278f2d494448a831b29cd6fa955e352b2a/tftp-hpa-0.49-fortify-strcpy-crash.patch --- tftp/tftp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tftp/tftp.c b/tftp/tftp.c index 33a4175..9c9c5af 100644 --- a/tftp/tftp.c +++ b/tftp/tftp.c @@ -278,15 +278,16 @@ makerequest(int request, const char *name, struct tftphdr *tp, const char *mode) { char *cp; + size_t len; tp->th_opcode = htons((u_short) request); cp = (char *)&(tp->th_stuff); - strcpy(cp, name); - cp += strlen(name); - *cp++ = '\0'; - strcpy(cp, mode); - cp += strlen(mode); - *cp++ = '\0'; + len = strlen(name) + 1; + memcpy(cp, name, len); + cp += len; + len = strlen(mode) + 1; + memcpy(cp, mode, len); + cp += len; return (cp - (char *)tp); }