Bug 80765

Summary: broken source code
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: pilot-linkAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
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 10:56:32 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 2002-12-30 23:58:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk  (Win98; I)

Description of problem:

Hello there,

I have just tried to compile pilot-link-0.11.3-3
from Redhat 8.0

Here are some of the messages the compiler produces

cc: Info: pilot-datebook-data.c, line 1263: In this statement, an array is being accessed outside the bounds specified for the array type. 
(subscrbounds)
cc: Info: pilot-datebook-windat.c, line 1152: In this statement, an array is being accessed outside the bounds specified for the array type. 
(subscrbounds)

Here is an untested patch to shut up the compiler.


./src/pilot-datebook/pilot-datebook-data.c.old ./src/pilot-datebook/pilot-datebook-data.c
*** ./src/pilot-datebook/pilot-datebook-data.c.old	Tue Dec 24 20:32:22 2002
--- ./src/pilot-datebook/pilot-datebook-data.c	Tue Dec 24 20:33:43 2002
***************
*** 1259,1266 ****
  	buffer[value_end - value_start] = '\0';
        }
        else {
! 	text_unquote(value_start, buffer, sizeof(buffer));
! 	buffer[sizeof(buffer)] = '\0';
        }
        value->type = DATEBOOK_FIELD_STR;
        value->literal.lit_str = strdup(buffer);
--- 1259,1266 ----
  	buffer[value_end - value_start] = '\0';
        }
        else {
! 	text_unquote(value_start, buffer, sizeof(buffer) - 1);
! 	buffer[sizeof(buffer) - 1] = '\0';
        }
        value->type = DATEBOOK_FIELD_STR;
        value->literal.lit_str = strdup(buffer);
./src/pilot-datebook/pilot-datebook-windat.c.old ./src/pilot-datebook/pilot-datebook-windat.c
*** ./src/pilot-datebook/pilot-datebook-windat.c.old	Tue Dec 24 20:34:08 2002
--- ./src/pilot-datebook/pilot-datebook-windat.c	Tue Dec 24 20:35:56 2002
***************
*** 1149,1155 ****
  				"Unfiled",
  				sizeof(header->aai.category.name) - 1);
  			header->aai.category.
! 			    name[0][sizeof(header->aai.category.name) -
  				    1] = '\0';
  			header->aai.category.ID[0] = 0;
  
--- 1149,1155 ----
  				"Unfiled",
  				sizeof(header->aai.category.name) - 1);
  			header->aai.category.
! 			    name[0][sizeof(header->aai.category.name[ 0]) -
  				    1] = '\0';
  			header->aai.category.ID[0] = 0;
  


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. compile with any C compiler that checks array indices at compile time,
for example compaq.
2.
3.
    

Additional info:

Comment 1 Than Ngo 2003-05-13 14:33:57 UTC
it's not a bug.

Comment 2 d.binderman 2003-07-05 08:14:36 UTC
>it's not a bug.

You seem to be new to C programming.

Have a look at page 22 of Kernighan & Ritchie Second edition.

It's a bug. I think so, the C compiler thinks so.

Comment 3 Than Ngo 2003-07-09 09:27:16 UTC
Oh, i have closed the wrong bug here, cut and paste problem :-( 

Of course it's a bug, which should be fixed. Thanks your info again.

Comment 4 Than Ngo 2004-06-30 10:56:32 UTC
it's fixed in pilot-link-0.11.8-6. Thanks for your report.