]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/tftp.c
tftp.c: fix CONFIG_TFTP_TSIZE for small files
[karo-tx-uboot.git] / net / tftp.c
index 3e99e7309116c333576a366735214ccb66c6fdc3..89be32a26bd8cfaca738bda523cc400830088fa4 100644 (file)
@@ -249,6 +249,8 @@ static void show_block_marker(void)
        if (tftp_tsize) {
                ulong pos = tftp_cur_block * tftp_block_size +
                        tftp_block_wrap_offset;
        if (tftp_tsize) {
                ulong pos = tftp_cur_block * tftp_block_size +
                        tftp_block_wrap_offset;
+               if (pos > tftp_tsize)
+                       pos = tftp_tsize;
 
                while (tftp_tsize_num_hash < pos * 50 / tftp_tsize) {
                        putc('#');
 
                while (tftp_tsize_num_hash < pos * 50 / tftp_tsize) {
                        putc('#');