Bug 79229

Summary: bad source code
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: ncpfsAssignee: Florian La Roche <laroche>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
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: 2003-02-08 22:09:57 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-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