[Bug 210937] devel/gmake: make-4.2.1/strcache.c's strcache_print_stats(. . .) uses %hu for an int value

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jul 9 08:38:45 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210937

            Bug ID: 210937
           Summary: devel/gmake: make-4.2.1/strcache.c's
                    strcache_print_stats(. . .) uses %hu for an int value
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: tijl at FreeBSD.org
          Reporter: markmi at dsl-only.net
             Flags: maintainer-feedback?(tijl at FreeBSD.org)
          Assignee: tijl at FreeBSD.org

make-4.2.1/strcache.c has code in strcache_print_stats(. . .) that looks like:

  printf (_("%s current buf: size = %hu B / used = %hu B / count = %hu / avg =
%hu B\n"),
          prefix, (sc_buflen_t)BUFSIZE, strcache->end, strcache->count,
          (strcache->end / strcache->count));

but (strcache->end / strcache->count) has an int type, not the unsigned short
type that the matching %hu format specifies.

The argument in question is an int already without promotion and could
potentially have a value that would be truncated by the format ignoring the
most significant part of the int value --thus leading to the compiler complaint
possibly not being a false positive for inaccurate/incomplete information being
printed.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list