(Finally) handle block number wraparound correctly.

This commit is contained in:
hpa 2001-11-13 03:11:52 +00:00
parent 52ffc49262
commit 480bee14e9
3 changed files with 14 additions and 5 deletions

View file

@ -1,5 +1,11 @@
$Id$
Changes in 0.24:
Fix bugs in both client and server dealing with block number
wraparound, usually manifesting themselves as failure to
handle files over 32 MB in size.
Changes in 0.23:
Correct memory overwrite bug in the tftp client when compiled
with readline.

View file

@ -104,7 +104,8 @@ tftp_sendfile(int fd, char *name, char *mode)
struct tftphdr *ap; /* data and ack packets */
struct tftphdr *dp;
int n;
volatile int block, size, convert;
volatile u_short block;
volatile int size, convert;
volatile unsigned long amount;
struct sockaddr_in from;
int fromlen;
@ -206,7 +207,8 @@ tftp_recvfile(int fd, char *name, char *mode)
struct tftphdr *ap;
struct tftphdr *dp;
int n;
volatile int block, size, firsttrip;
volatile u_short block;
volatile int size, firsttrip;
volatile unsigned long amount;
struct sockaddr_in from;
int fromlen;

View file

@ -926,7 +926,7 @@ tftp_sendfile(struct formats *pf, struct tftphdr *oap, int oacklen)
{
struct tftphdr *dp;
struct tftphdr *ap; /* ack packet */
static int block = 1; /* Static to avoid longjmp funnies */
static u_short block = 1; /* Static to avoid longjmp funnies */
int size, n;
ap = (struct tftphdr *)ackbuf;
@ -1036,8 +1036,9 @@ tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen)
int n, size;
/* These are "static" to avoid longjmp funnies */
static struct tftphdr *ap; /* ack buffer */
static int block = 0, acksize;
static u_short block = 0;
static int acksize;
dp = w_init();
do {
timeout = 0;