1 |
commit: 0fa69c398bad7bda3486b713e995be01847126d1 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 23 23:48:12 2017 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 23 23:48:12 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=0fa69c39 |
7 |
|
8 |
scanelf: change abs() to a size_t cast |
9 |
|
10 |
The point of using abs here was to avoid a signed-vs-unsigned warning, |
11 |
but it doesn't actually work because abs() returns a signed integer. |
12 |
Since we always know end is larger than start, cast the result to a |
13 |
size_t instead. |
14 |
|
15 |
scanelf.c | 2 +- |
16 |
1 file changed, 1 insertion(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/scanelf.c b/scanelf.c |
19 |
index 9c52ced..2729d0f 100644 |
20 |
--- a/scanelf.c |
21 |
+++ b/scanelf.c |
22 |
@@ -836,7 +836,7 @@ static void scanelf_file_rpath(elfobj *elf, char *found_rpath, char **ret, size_ |
23 |
while (start) { \ |
24 |
rpath_security_checks(elf, start, get_elfdtype(word)); \ |
25 |
end = strchr(start, ':'); \ |
26 |
- len = (end ? abs(end - start) : strlen(start)); \ |
27 |
+ len = (end ? (size_t)(end - start) : strlen(start)); \ |
28 |
if (use_ldcache) { \ |
29 |
size_t n; \ |
30 |
const char *ldpath; \ |