Bug 111029 - bad source code
Summary: bad source code
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: pilot-link (Show other bugs)
(Show other bugs)
Version: 1
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Ngo Than
QA Contact:
URL:
Whiteboard:
Keywords:
: 106299 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-26 15:35 UTC by d.binderman
Modified: 2007-11-30 22:10 UTC (History)
0 users

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: ---


Attachments (Terms of Use)

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 Ngo Than 2004-06-30 13:07:18 UTC
*** Bug 106299 has been marked as a duplicate of this bug. ***

Comment 2 Ngo Than 2004-06-30 13:08:30 UTC
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.