[Bug 229713] src/crypto/heimdal/appl/push/push.c:270: poor error handling ?

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jul 12 09:30:03 UTC 2018


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

            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 at FreeBSD.org
          Reporter: dcb314 at hotmail.com

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

Source code is

    from_line_length = 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. 

Suggest sanity check return value from snprintf *before* storing in an unsigned
variable.

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


More information about the freebsd-bugs mailing list