commit:     0fa69c398bad7bda3486b713e995be01847126d1
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 23 23:48:12 2017 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jan 23 23:48:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=0fa69c39

scanelf: change abs() to a size_t cast

The point of using abs here was to avoid a signed-vs-unsigned warning,
but it doesn't actually work because abs() returns a signed integer.
Since we always know end is larger than start, cast the result to a
size_t instead.

 scanelf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scanelf.c b/scanelf.c
index 9c52ced..2729d0f 100644
--- a/scanelf.c
+++ b/scanelf.c
@@ -836,7 +836,7 @@ static void scanelf_file_rpath(elfobj *elf, char 
*found_rpath, char **ret, size_
                                while (start) { \
                                        rpath_security_checks(elf, start, 
get_elfdtype(word)); \
                                        end = strchr(start, ':'); \
-                                       len = (end ? abs(end - start) : 
strlen(start)); \
+                                       len = (end ? (size_t)(end - start) : 
strlen(start)); \
                                        if (use_ldcache) { \
                                                size_t n; \
                                                const char *ldpath; \

Reply via email to