Blame SOURCES/tftp-hpa-0.49-fortify-strcpy-crash.patch

6ed84f
diff -urN tftp-hpa-0.49.orig/tftp/tftp.c tftp-hpa-0.49/tftp/tftp.c
6ed84f
--- tftp-hpa-0.49.orig/tftp/tftp.c	2008-10-20 18:08:31.000000000 -0400
6ed84f
+++ tftp-hpa-0.49/tftp/tftp.c	2009-08-05 09:47:18.072585848 -0400
6ed84f
@@ -279,15 +279,16 @@
6ed84f
             struct tftphdr *tp, const char *mode)
6ed84f
 {
6ed84f
     char *cp;
6ed84f
+    size_t len;
6ed84f
 
6ed84f
     tp->th_opcode = htons((u_short) request);
6ed84f
     cp = (char *)&(tp->th_stuff);
6ed84f
-    strcpy(cp, name);
6ed84f
-    cp += strlen(name);
6ed84f
-    *cp++ = '\0';
6ed84f
-    strcpy(cp, mode);
6ed84f
-    cp += strlen(mode);
6ed84f
-    *cp++ = '\0';
6ed84f
+    len = strlen(name) + 1;
6ed84f
+    memcpy(cp, name, len);
6ed84f
+    cp += len;
6ed84f
+    len = strlen(mode) + 1;
6ed84f
+    memcpy(cp, mode, len);
6ed84f
+    cp += len;
6ed84f
     return (cp - (char *)tp);
6ed84f
 }
6ed84f