Package: file / 1:5.35-4+deb10u2

cherry-pick.FILE5_35-1-g338cc788.-c-cast.patch Patch series | download
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
35
36
37
38
39
40
41
42
43
44
45
46
47
Subject: - C++ cast (...)
Origin: FILE5_35-1-g338cc788 <https://github.com/file/file/commit/FILE5_35-1-g338cc788>
Upstream-Author: Christos Zoulas <christos@zoulas.com>
Date: Fri Oct 19 00:26:08 2018 +0000

    - C++ cast
    - return 0 instead of -1 for error in donote

--- a/src/readelf.c
+++ b/src/readelf.c
@@ -786,8 +786,8 @@
 			pidoff = argoff + 81 + 2;
 			if (doff + pidoff + 4 <= size) {
 				if (file_printf(ms, ", pid=%u",
-				    elf_getu32(swap, *(uint32_t *)(nbuf +
-				    doff + pidoff))) == -1)
+				    elf_getu32(swap, *RCAST(uint32 *, (nbuf +
+				    doff + pidoff)))) == -1)
 					return 1;
 			}
 			*flags |= FLAGS_DID_CORE;
@@ -1142,14 +1142,14 @@
 	if (namesz & 0x80000000) {
 		if (file_printf(ms, ", bad note name size %#lx",
 		    CAST(unsigned long, namesz)) == -1)
-			return -1;
+			return 0;
 	    return 0;
 	}
 
 	if (descsz & 0x80000000) {
 		if (file_printf(ms, ", bad note description size %#lx",
 		    CAST(unsigned long, descsz)) == -1)
-		    	return -1;
+		    	return 0;
 	    return 0;
 	}
 
@@ -1668,7 +1668,7 @@
 		case PT_INTERP:
 			if (bufsize && nbuf[0]) {
 				nbuf[bufsize - 1] = '\0';
-				memcpy(interp, nbuf, bufsize);
+				memcpy(interp, nbuf, (size_t)bufsize);
 			} else
 				strlcpy(interp, "*empty*", sizeof(interp));
 			break;