Bug 79229 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ncpfs
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Florian La Roche
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-08 10:27 UTC by d.binderman
Modified: 2007-04-18 16:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-02-08 22:09:57 UTC
Embargoed:


Attachments (Terms of Use)

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

Hello there,

I just tried to compile package ncpfs-2.2.0.18-11 from Redhat 8.0.

Here are some of the compiler messages.

ncpmount.c:306: warning: operation on `ptr' may be undefined
ncpmount.c:311: warning: operation on `ptr' may be undefined

Here is a patch which fixes the messages.

*** ./sutil/ncpmount.c.old	2002-11-18 10:22:58.000000000 +0000
--- ./sutil/ncpmount.c	2002-11-18 10:24:43.000000000 +0000
***************
*** 303,314 ****
  	ptr = dst[0] + strlen(dst[0]);
  	for (count = 1; count < argc; count++) {
  		if (dst[count] == ptr + 1)
! 			ptr += strlen(++ptr);
  	}
  	if (environ[0] == ptr + 1) {
  		for (count = 0; environ[count]; count++)
  			if (environ[count] == ptr + 1)
! 				ptr += strlen(++ptr);
  	}
  	count = 0;
  	for (ptr2 = dst[0]; ptr2 <= ptr; ptr2++) {
--- 303,320 ----
  	ptr = dst[0] + strlen(dst[0]);
  	for (count = 1; count < argc; count++) {
  		if (dst[count] == ptr + 1)
!                 {
! 			++ptr;
! 			ptr += strlen( ptr);
!                 }
  	}
  	if (environ[0] == ptr + 1) {
  		for (count = 0; environ[count]; count++)
  			if (environ[count] == ptr + 1)
! 			{
! 				++ptr;
! 				ptr += strlen( ptr);
! 			}
  	}
  	count = 0;
  	for (ptr2 = dst[0]; ptr2 <= ptr; ptr2++) {


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


How Reproducible:


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:


Expected Results:


Additional Information:

Comment 1 Florian La Roche 2003-01-08 12:58:51 UTC
Does not look like a bug or undefined behaviour,

Florian La Roche


Comment 2 d.binderman 2003-01-08 22:39:43 UTC
>Does not look like a bug or undefined behaviour,

You need to learn more about ISO C.

Try having a look at section 2.12 of K&R 2, about page 53 in my copy.
 

Comment 3 Florian La Roche 2003-02-08 22:09:57 UTC
Fixed in 2.2.1-1, soon in rawhide.

greetings,

Florian La Roche



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