File: Wrong-CRC-with-ASCII-CRC-for-large-files.patch

package info (click to toggle)
cpio 2.13%2Bdfsg-7.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,192 kB
  • sloc: ansic: 43,585; sh: 8,178; yacc: 1,791; makefile: 260; sed: 16
file content (34 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From: Stefano Babic <sbabic@denx.de>
Date: Fri, 28 Jul 2017 13:20:52 +0200
Subject: Wrong CRC with ASCII CRC for large files

Due to signedness, the checksum is not computed when filesize is bigger
a 2GB.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 src/copyout.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/copyout.c b/src/copyout.c
index 1f0987a..727aeca 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -34,13 +34,13 @@
    compute and return a checksum for them.  */
 
 static uint32_t
-read_for_checksum (int in_file_des, int file_size, char *file_name)
+read_for_checksum (int in_file_des, unsigned int file_size, char *file_name)
 {
   uint32_t crc;
   char buf[BUFSIZ];
-  int bytes_left;
-  int bytes_read;
-  int i;
+  unsigned int bytes_left;
+  unsigned int bytes_read;
+  unsigned int i;
 
   crc = 0;