Applying Arch Linux Patch

a70146278f/tftp-hpa-0.49-fortify-strcpy-crash.patch
This commit is contained in:
Alexander Zhirov 2025-04-25 01:21:57 +03:00
parent 2c86ff58dc
commit 37ac880897

View file

@ -278,15 +278,16 @@ makerequest(int request, const char *name,
struct tftphdr *tp, const char *mode) struct tftphdr *tp, const char *mode)
{ {
char *cp; char *cp;
size_t len;
tp->th_opcode = htons((u_short) request); tp->th_opcode = htons((u_short) request);
cp = (char *)&(tp->th_stuff); cp = (char *)&(tp->th_stuff);
strcpy(cp, name); len = strlen(name) + 1;
cp += strlen(name); memcpy(cp, name, len);
*cp++ = '\0'; cp += len;
strcpy(cp, mode); len = strlen(mode) + 1;
cp += strlen(mode); memcpy(cp, mode, len);
*cp++ = '\0'; cp += len;
return (cp - (char *)tp); return (cp - (char *)tp);
} }