NetBSD-Bugs archive

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

lib/51003: src/lib/libc/time/zic.c:2561]: (error) Uninitialized variable: xr



>Number:         51003
>Category:       lib
>Synopsis:       src/lib/libc/time/zic.c:2561]: (error) Uninitialized variable: xr
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 24 12:35:00 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160324
>Organization:
>Environment:
>Description:

Source code is

        struct rule xr;
        struct attype *lastat;
        xr.r_month = TM_JANUARY;
        xr.r_dycode = DC_DOM;
        xr.r_dayofmonth = 1;
        xr.r_tod = 0;
        for (lastat = &attypes[0], i = 1; i < timecnt; i++)
            if (attypes[i].at > lastat->at)
                lastat = &attypes[i];
        if (lastat->at < rpytime(&xr, max_year - 1)) {

So local variable xr is only partially initialised when it
is given to rpytime. 

Suggest initialise all fields of xr to something sensible, maybe
with a call to memset, shortly after its declaration.

    memset( &xr, 0, sizeof( xr));



 
>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index