Bug 239956

Summary: smartmontools-5.36.cvs20061025-11: array subscript is above array bounds
Product: [openSUSE] openSUSE 10.3 Reporter: David Binderman <dcb314>
Component: OtherAssignee: Stanislav Brabec <sbrabec>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: SUSE Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description David Binderman 2007-01-29 19:04:34 UTC
I just tried to compile package smartmontools-5.36.cvs20061025-11
with the new GNU compiler version 4.3 snapshot 20070126

The compiler said

os_linux.cpp:724: warning: array subscript is above array bounds

The source code is

    for (i=0; i<CISS_MAX_LUN+1; i++)
    {
        if (luns->LUN[i][6] == target)

but

typedef struct _ReportLUNdata_struct
{
  BYTE LUNListLength[4];
  DWORD reserved;
  BYTE LUN[CISS_MAX_LUN][8];
} ReportLunData_struct;

So i has the value CISS_MAX_LUN on the final execution of the for loop,
but this index value is not permitted.

Suggest code rework.
Comment 1 Stefan Dirsch 2007-01-31 22:40:49 UTC
Feel free to close as duplicate of Bug #240922.
Comment 2 Petr Gajdos 2007-03-05 11:05:53 UTC
fixed

*** This bug has been marked as a duplicate of bug 240922 ***