Bug 110771 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mc
Version: 1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard: triage|leonardjo|patch|easyfix
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-24 15:28 UTC by d.binderman
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version: 4.6.0-14.10
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-23 00:40:04 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch to correct range (769 bytes, patch)
2004-03-31 16:35 UTC, Leonard den Ottolander
no flags Details | Diff

Description d.binderman 2003-11-24 15:28:54 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Description of problem:

I just tried to compile package mc-4_6_0-5 from Fedora.

The compiler said

1.

direntry.c(626): warning #175: subscript out of range

The source code is

        dir.dent.d_name[MC_MAXPATHLEN] = 0;

Suggest

        dir.dent.d_name[ MC_MAXPATHLEN - 1] = 0;

might be better code.

2.

extfs.c(892): warning #175: subscript out of range

The source code is

    dir.dent.d_name[MC_MAXPATHLEN] = 0;

Same problem as above.


Version-Release number of selected component (if applicable):
mc-4_6_0-5 

How reproducible:
Always

Steps to Reproduce:
1. by inspection
2.
3.
    

Additional info:

Comment 1 Miloslav Trmac 2004-03-11 14:05:26 UTC
This looks fine in current CVS version.

Comment 2 Leonard den Ottolander 2004-03-31 16:31:33 UTC
This might be fine in current CVS, but should be fixed if an update is
released.

EASYFIX


Comment 3 Leonard den Ottolander 2004-03-31 16:35:57 UTC
Created attachment 99008 [details]
Patch to correct range

Comment 4 Leonard den Ottolander 2004-05-02 15:57:53 UTC
Why didn't this fix end up in the latest erratum? This is an easy fix
with an attached patch.


Comment 5 Leonard den Ottolander 2004-08-22 11:00:43 UTC
Please add this patch before releasing the next update!


Comment 6 Leonard den Ottolander 2004-08-23 00:40:04 UTC
There is a fix for this already in the jumbo patch:

+++ mc-4.6.0/vfs/direntry.c	2004-04-05 12:20:09.000000000 +0200
-	strncpy(dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
-	dir.dent.d_name[MC_MAXPATHLEN] = 0;
+	g_strlcpy(dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
+++ mc-4.6.0/vfs/extfs.c

I guess I should close it, so I won't think this issue is still
unresolved ;) .



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