Bug 79229 - bad source code
bad source code
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: ncpfs (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Florian La Roche
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-08 05:27 EST by d.binderman
Modified: 2007-04-18 12:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-02-08 17:09:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2002-12-08 05:27:07 EST
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 07:58:51 EST
Does not look like a bug or undefined behaviour,

Florian La Roche
Comment 2 d.binderman 2003-01-08 17:39:43 EST
>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 17:09:57 EST
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.