Bug 156027 - someone is unfamiliar with C arrays ?
someone is unfamiliar with C arrays ?
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: nut (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-26 14:40 EDT by David Binderman
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-07-20 08:58:32 EDT
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 David Binderman 2005-04-26 14:40:38 EDT
Description of problem:

I just tried to compile nut-2.0.1-1 from Redhat
Fedora Core development tree with the most excellent Intel C
compiler.

The compiler said

1.

tripplite.c(147): warning #175: subscript out of range

The source code is

        char buf[32];
        buf[32] = '\0';

Doh. Clearly wrong code. Suggest increase size of buffer by one.

2.

bestfcom.c(530): warning #175: subscript out of range

The source code is

	rstring[sizeof(rstring)] = '\0';

More clearly wrong code. Suggest  

	rstring[ sizeof(rstring) - 1 ] = '\0';

might be better code.


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


How reproducible:


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


Expected results:


Additional info:
Comment 1 Ngo Than 2005-07-20 08:58:32 EDT
it's now fixed in nut-2.0.2-1. I will forward the fix to the upstream autor.
Many thanks for your report.

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