NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-hpcmips/52445: src/sys/arch/hpcmips/stand/pbsdboot/main.c: 2 * poor error checking ?



>Number:         52445
>Category:       port-hpcmips
>Synopsis:       src/sys/arch/hpcmips/stand/pbsdboot/main.c: 2 * poor error checking ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-hpcmips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 31 12:40:00 +0000 2017
>Originator:     David Binderman
>Release:        cvs-20170731
>Organization:
>Environment:
>Description:
src/sys/arch/hpcmips/stand/pbsdboot/main.c:1121]: (style) Checking if unsigned variable 'wcstombs(kernel_name,wkernel_name,sizeof(kernel_name))' is less than zero.

Source code is

    if (wcstombs(options, woptions, sizeof(options)) < 0 ||
        wcstombs(kernel_name, wkernel_name,
                 sizeof(kernel_name)) < 0) {

After a few seconds checking the man page for wcstombs, maybe the
following is better code

    if (wcstombs(options, woptions, sizeof(options)) == (size_t) -1 ||
        wcstombs(kernel_name, wkernel_name,
                 sizeof(kernel_name)) == (size_t) -1) {

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index