Bug 111029

Summary: bad source code
Product: [Fedora] Fedora Reporter: d.binderman
Component: pilot-linkAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-06-30 13:08:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2003-11-26 15:35:13 UTC
Description of problem:
I just tried to compile package pilot-link-0_11_8-1 from Fedora.

The compiler said

1.

pilot-datebook-longtxt.c:2184: warning: too few arguments for format

The source code is

        num_read = sscanf (buffer, LONGTXT_HEADER_CATEGORY_ROW_FORMAT,
                           buffer1,
                           &((aai.category).ID[j]),
                           buffer2,
                           &((aai.category).name[j]));

But

const char LONGTXT_HEADER_CATEGORY_ROW_FORMAT[] = "%d\t%u\t%s\t%s%s\n";

Five % specifiers, only four parameters after the specifier.

2.

pi-file.c(1326): remark #592: variable "flags" is used before its
value is set

The source code is

	int     flags;

        if (pf->info.creator == pi_mktag('g', 'r', 'a', 'f')) {
                flags |= dlpDBFlagNewer;
                flags |= dlpDBFlagReset;
        }

Suggest init flags before first use.

3.

pilot-datebook-data.c(1263): warning #175: subscript out of range

The source code is

        buffer[sizeof(buffer)] = '\0';

This will never work in a month of Sundays. Suggest

        buffer[sizeof(buffer) - 1] = '\0';

4.

pilot-datebook-windat.c(1153): warning #175: subscript out of range

The source code is

	header->aai.category.name[0][ sizeof(header->aai.category.name) - 1]
= '\0';

Maybe 

	header->aai.category.name[0][ 
		sizeof(header->aai.category.name[ 0]) - 1] = '\0';

is what you meant.



Version-Release number of selected component (if applicable):
pilot-link-0_11_8-1 

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Than Ngo 2004-06-30 13:07:18 UTC
*** Bug 106299 has been marked as a duplicate of this bug. ***

Comment 2 Than Ngo 2004-06-30 13:08:30 UTC
it's fixed in 0.11.8-6. Thanks for your report.