=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tftp/tftp.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/tftp/tftp.c 2002/02/16 21:27:55 1.10 --- src/usr.bin/tftp/tftp.c 2003/04/17 17:17:27 1.11 *************** *** 1,4 **** ! /* $OpenBSD: tftp.c,v 1.10 2002/02/16 21:27:55 millert Exp $ */ /* $NetBSD: tftp.c,v 1.5 1995/04/29 05:55:25 cgd Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: tftp.c,v 1.11 2003/04/17 17:17:27 henning Exp $ */ /* $NetBSD: tftp.c,v 1.5 1995/04/29 05:55:25 cgd Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93"; #endif ! static char rcsid[] = "$OpenBSD: tftp.c,v 1.10 2002/02/16 21:27:55 millert Exp $"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton */ --- 38,44 ---- #if 0 static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93"; #endif ! static const char rcsid[] = "$OpenBSD: tftp.c,v 1.11 2003/04/17 17:17:27 henning Exp $"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton */ *************** *** 58,63 **** --- 58,64 ---- #include #include #include + #include #include #include #include *************** *** 96,108 **** char *name; char *mode; { ! struct tftphdr *ap; /* data and ack packets */ ! struct tftphdr *r_init(), *dp; ! int n; volatile int block, size, convert; volatile unsigned long amount; struct sockaddr_in from; ! int fromlen; FILE *file; startclock(); /* start stat's clock */ --- 97,107 ---- char *name; char *mode; { ! struct tftphdr *dp, *ap; /* data and ack packets */ volatile int block, size, convert; volatile unsigned long amount; struct sockaddr_in from; ! int n, fromlen; FILE *file; startclock(); /* start stat's clock */ *************** *** 201,213 **** char *name; char *mode; { ! struct tftphdr *ap; ! struct tftphdr *dp, *w_init(); ! int n; volatile int block, size, firsttrip; volatile unsigned long amount; struct sockaddr_in from; ! int fromlen; FILE *file; volatile int convert; /* true if converting crlf -> lf */ --- 200,210 ---- char *name; char *mode; { ! struct tftphdr *dp, *ap; volatile int block, size, firsttrip; volatile unsigned long amount; struct sockaddr_in from; ! int n, fromlen; FILE *file; volatile int convert; /* true if converting crlf -> lf */ *************** *** 312,327 **** const char *mode; { char *cp; tp->th_opcode = htons((u_short)request); cp = tp->th_stuff; ! strcpy(cp, name); ! cp += strlen(name); ! *cp++ = '\0'; ! strcpy(cp, mode); ! cp += strlen(mode); ! *cp++ = '\0'; ! return (cp - (char *)tp); } struct errmsg { --- 309,324 ---- const char *mode; { char *cp; + int len, pktlen; tp->th_opcode = htons((u_short)request); cp = tp->th_stuff; ! pktlen = PKTSIZE - offsetof(struct tftphdr, th_stuff); ! len = strlen(name) + 1; ! strlcpy(cp, name, pktlen); ! strlcpy(cp + len, mode, pktlen - len); ! len += strlen(mode) + 1; ! return (cp + len - (char *)tp); } struct errmsg {