Bug 10211 - mkpasswd.c:183: pointless test ?
Summary: mkpasswd.c:183: pointless test ?
Status: RESOLVED WONTFIX
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 trivial
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-09 20:23 UTC by David Binderman
Modified: 2018-01-10 22:08 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2017-08-09 20:23:46 UTC
buildroot-2017.08-rc1/package/mkpasswd/mkpasswd.c:183]: (style) Checking if unsigned variable 'rounds' is less than zero.

Source code is

        rounds = strtol(optarg, &p, 10);
        if (p == NULL || *p != '\0' || rounds < 0) {

Maybe a call to strtoul would be better ?
Comment 1 Thomas Petazzoni 2018-01-10 22:08:20 UTC
This code comes from the whois project at https://github.com/rfc1036/whois/blob/next/mkpasswd.c. If there are any issues, please report them to the upstream project. We can then backport the fix, or upgrade to a newer version.