Bug 111029 - bad source code
bad source code
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: pilot-link (Show other bugs)
1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
:
: 106299 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-26 10:35 EST by d.binderman
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-06-30 09:08:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2003-11-26 10:35:13 EST
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 Ngo Than 2004-06-30 09:07:18 EDT
*** Bug 106299 has been marked as a duplicate of this bug. ***
Comment 2 Ngo Than 2004-06-30 09:08:30 EDT
it's fixed in 0.11.8-6. Thanks for your report.

Note You need to log in before you can comment on or make changes to this bug.