Bug 79237 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: pilot-link
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Than Ngo
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-08 10:49 UTC by d.binderman
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-12-08 10:49:15 UTC
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2002-12-08 10:49:08 UTC
Description of Problem:

Hello there,

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

Here are some of the compiler messages.

pilot-datebook-longtxt.c:2184: warning: too few arguments for format
install-datebook.c:242: warning: too few arguments for format
pilot-xfer.c:307: warning: `totalsize' might be used uninitialized in this function
pilot-xfer.c:835: warning: `totalsize' might be used uninitialized in this function

For the first warning, text string LONGTXT_HEADER_CATEGORY_ROW_FORMAT
has five % specifiers, but only four variables are provided in the
sscanf parameter list. I do not know what the fix for this might be.

For the second warning, the offending source code is

                        printf("Description: %s, %s, %s\n",
                                appointment.description);
 
Clearly, three strings are printed, but only one string is supplied.
This will certainly go wrong at run time.

Here is a patch which fixes the last two messages.

*** ./src/pilot-xfer.c.old	2002-11-19 12:25:36.000000000 +0000
--- ./src/pilot-xfer.c	2002-11-19 12:25:55.000000000 +0000
***************
*** 304,310 ****
  	int 	i,
  		ofile_len,
  		ofile_total,
! 		totalsize;
  
  	struct 	dirent *dirent;
  	struct 	stat sbuf;
--- 304,310 ----
  	int 	i,
  		ofile_len,
  		ofile_total,
! 		totalsize = 0;
  
  	struct 	dirent *dirent;
  	struct 	stat sbuf;
***************
*** 832,838 ****
   ***********************************************************************/
  static void Install(char *filename)
  {
! 	int totalsize;
  
  	struct 	pi_file *f;
  	struct 	stat sbuf;
--- 832,838 ----
   ***********************************************************************/
  static void Install(char *filename)
  {
! 	int totalsize = 0;
  
  	struct 	pi_file *f;
  	struct 	stat sbuf;
  


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


How Reproducible:


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:


Expected Results:


Additional Information:

Comment 1 Ngo Than 2002-12-08 20:59:38 UTC
The first warning could be ignore.
The rest is fixed in pilot-link-0.11.5-3 or newer. Thanks for your report.


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