Bug 111081 - bad source code
bad source code
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: pump (Show other bugs)
1
All Linux
medium Severity low
: ---
: ---
Assigned To: Jeremy Katz
:
: 106302 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-27 05:10 EST by d.binderman
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version: 0.8.23-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-11 11:37:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2003-11-27 05:10:39 EST
Description of problem:
I just tried to compile package pump-0.8.19-2 from Fedora.

The compiler said

1.

dhcp.c:708: warning: operation on `vndptr' may be undefined
dhcp.c:708: warning: operation on `vndptr' may be undefined
dhcp.c:708: warning: operation on `vndptr' may be undefined

The source code is

    sprintf (vendor, "0x%02x 0x%02x 0x%02x 0x%02x", *vndptr++,
*vndptr++, *vndptr++, *vndptr++);

Better code might be

    sprintf (vendor, "0x%02x 0x%02x 0x%02x 0x%02x", vndptr[ 0],
vndptr[ 1], 
		vndptr[ 2], vndptr[ 3]);
    vndptr += 4;

2.

pump.c(600): warning #175: subscript out of range

The source code is

	cmd.u.status.hostname[sizeof(cmd.u.status.hostname)] = '\0';

Better might be

	cmd.u.status.hostname[sizeof(cmd.u.status.hostname) - 1] = '\0';



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

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Brent Fox 2004-02-19 18:41:25 EST
*** Bug 106302 has been marked as a duplicate of this bug. ***
Comment 2 David Binderman 2004-11-05 14:45:09 EST
I can confirm that the "subscript out of range" warning message
still occurs for the version of this package in Fedora Core 3 Test 3.

Just over 11 months and no fix yet in Fedora.
Comment 3 David Binderman 2005-10-05 05:09:19 EDT
I can confirm that this bug still exists in Core 4, nearly
two years after it was first posted.
Comment 4 Jeremy Katz 2005-10-11 11:37:54 EDT
Fixed all warnings in CVS and build with -Werror now

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