Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Jul 2016 08:38:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 210937] devel/gmake: make-4.2.1/strcache.c's strcache_print_stats(. . .) uses %hu for an int value
Message-ID:  <bug-210937-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D210937

            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@FreeBSD.org
          Reporter: markmi@dsl-only.net
             Flags: maintainer-feedback?(tijl@FreeBSD.org)
          Assignee: tijl@FreeBSD.org

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

  printf (_("%s current buf: size =3D %hu B / used =3D %hu B / count =3D %h=
u / avg =3D
%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 sho=
rt
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 compl=
aint
possibly not being a false positive for inaccurate/incomplete information b=
eing
printed.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-210937-13>