net: tftp: Fix TFTP Transfer Size data type
The TFTP transfer size is unsigned integer, update the data type and print formating string accordingly to prevent an overflow in case the file size is longer than 2 GiB. TFTP transfer of a 3 GiB file, before (wrong) and after (right): Loading: ################################################# 16 EiB Loading: ################################################## 3 GiB Signed-off-by: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
This commit is contained in:
committed by
Jerome Forissier
parent
86f90e2a5f
commit
a28db0f1cc
+2
-2
@@ -94,7 +94,7 @@ static int tftp_state;
|
||||
static ulong tftp_load_addr;
|
||||
#ifdef CONFIG_TFTP_TSIZE
|
||||
/* The file size reported by the server */
|
||||
static int tftp_tsize;
|
||||
static unsigned int tftp_tsize;
|
||||
/* The number of hashes we printed */
|
||||
static short tftp_tsize_num_hash;
|
||||
#endif
|
||||
@@ -573,7 +573,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
|
||||
if (strcasecmp((char *)pkt + i, "tsize") == 0) {
|
||||
tftp_tsize = dectoul((char *)pkt + i + 6,
|
||||
NULL);
|
||||
debug("size = %s, %d\n",
|
||||
debug("size = %s, %u\n",
|
||||
(char *)pkt + i + 6, tftp_tsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user