From: Tollef Fog Heen Date: Tue, 17 Jan 2012 20:30:42 +0000 (+0100) Subject: Fix off-by-one error X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f38e60cbeb2be872c00a9c155092eacc847a9773;p=gant Fix off-by-one error --- diff --git a/fr60.c b/fr60.c index 17564f5..32fc5bf 100644 --- a/fr60.c +++ b/fr60.c @@ -401,7 +401,7 @@ save_antfs_file(const uchar chan, const uchar* blast, uint blsize) if (verbose) printf("%s (%d bytes)\n", filename, size); ANT_RequestMessage(chan, MESG_CHANNEL_STATUS_ID); //informative if (offset+remaining < size) { - int16_t crc = le16_read(blast + blsize - 1); + int16_t crc = le16_read(blast + blsize - 2); printf("=> Starting download: %d %d %d\n", offset, remaining, size); start_download(chan, antfsdir[downloadingfilenum].fileno,offset+remaining, crc, 0); @@ -648,7 +648,7 @@ chevent(uchar chan, uchar event) decode_antfs_dir(blast, blsize); if (offset+remaining < size) { - int16_t crc = le16_read(blast + blsize - 1); + int16_t crc = le16_read(blast + blsize - 2); start_download(chan, 0, offset+remaining, crc, 0); return 1; }