Bug 156027 - someone is unfamiliar with C arrays ?
Summary: someone is unfamiliar with C arrays ?
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: nut
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-26 18:40 UTC by David Binderman
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-07-20 12:58:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Binderman 2005-04-26 18:40:38 UTC
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 Than Ngo 2005-07-20 12:58:32 UTC
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.