Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jul 2018 09:30:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 229713] src/crypto/heimdal/appl/push/push.c:270: poor error handling ?
Message-ID:  <bug-229713-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 229713
           Summary: src/crypto/heimdal/appl/push/push.c:270: poor error
                    handling ?
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: dcb314@hotmail.com

src/crypto/heimdal/appl/push/push.c:270]: (style) Checking if unsigned vari=
able
'from_line_length' is less than zero.

Source code is

    from_line_length =3D snprintf (from_line, sizeof(from_line),
                                 "From %s %s", "push", ctime(&now));
    if (from_line_length < 0 || from_line_length > sizeof(from_line))
        errx (1, "snprintf failed");

but variable from_line_length is unsigned and the return value
from snprintf is int.=20

Suggest sanity check return value from snprintf *before* storing in an unsi=
gned
variable.

--=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-229713-227>