Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jul 2018 10:48:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 229720] src/lib/libugidfw/ugidfw.c:105: poor error checking ?
Message-ID:  <bug-229720-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

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

            Bug ID: 229720
           Summary: src/lib/libugidfw/ugidfw.c:105: poor error checking ?
           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/lib/libugidfw/ugidfw.c:105]: (style) Checking if unsigned variable 'len' is
less than zero.

Source code is

           len = snprintf(cur, left, "uid %s",
                                    pwd->pw_name);
           if (len < 0 || len > left)

but len is unsigned and the return value from snprintf is int. 

Suggest sanity check return value before assignment into unsigned variable.

Multiple duplicates:

src/lib/libugidfw/ugidfw.c:112]: (style) Checking if unsigned variable 'len' is
less than zero.
[src/lib/libugidfw/ugidfw.c:123]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:130]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:137]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:145]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:155]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:162]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:173]: (style) Checking if unsigned variable 'len'
is less than zero.
[src/lib/libugidfw/ugidfw.c:180]: (style) Checking if unsigned variable 'len'
is less than zero.
...

-- 
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-229720-227>