From: AZero13 Date: Fri, 11 Apr 2025 03:14:55 +0000 (-0400) Subject: i should be size_t (#2575) X-Git-Tag: v3.8.0~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da6bc7bf279d7dd3245ccd54c0373d442c595197;p=thirdparty%2Flibarchive.git i should be size_t (#2575) The size of i does not matter, and a size_t is added to it, so to avoid that truncation, just make i size_t. It also is passed as a size_t. --- diff --git a/tar/util.c b/tar/util.c index e46700821..a63883527 100644 --- a/tar/util.c +++ b/tar/util.c @@ -82,7 +82,7 @@ safe_fprintf(FILE *f, const char *fmt, ...) int length, n; va_list ap; const char *p; - unsigned i; + size_t i; wchar_t wc; char try_wc; @@ -153,13 +153,13 @@ safe_fprintf(FILE *f, const char *fmt, ...) } else { /* Not printable, format the bytes. */ while (n-- > 0) - i += (unsigned)bsdtar_expand_char( + i += bsdtar_expand_char( outbuff, sizeof(outbuff), i, *p++); } } else { /* After any conversion failure, don't bother * trying to convert the rest. */ - i += (unsigned)bsdtar_expand_char(outbuff, sizeof(outbuff), i, *p++); + i += bsdtar_expand_char(outbuff, sizeof(outbuff), i, *p++); try_wc = 0; }