Bug 152209

Summary: tkrat-2.1.5-6: 2 * array subscript out of range
Product: [openSUSE] SUSE LINUX 10.0 Reporter: David Binderman <dcb314>
Component: BasesystemAssignee: Reinhard Max <max>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: SuSE Linux 10.1   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description David Binderman 2006-02-20 11:02:56 UTC
I just tried to compile package tkrat-2.1.5-6 with a non standard
version of the GNU C compiler.

It said

1.

ratCode.c:874: warning: array subscript out of range

The source code is

	buf[0] = buf[3];

but

	unsigned char buf[3];

Suggest make array buf one bigger.

2.

ratDbFolder.c:403: warning: array subscript out of range

The source code is

            case 'T':   flagArray[RAT_DRAFT] = 1; break;

but

    int flagArray[4] = {0,0,0,0};

and

typedef enum {
    RAT_SEEN,                   /* Message content has been seen by the user */
    RAT_DELETED,                /* Message is marked for deletion */
    RAT_FLAGGED,                /* Message is flagged */
    RAT_ANSWERED,               /* Message has been answered */
    RAT_DRAFT,                  /* Message is a draft */
    RAT_RECENT                  /* Message is a not seen but has been in the
                                   folder for some time */
} RatFlag;

so the program is trying to access flagArray[ 4]. Suggest code rework.
Comment 1 Reinhard Max 2006-02-20 23:05:06 UTC
Fixed for 10.1.