Bug 110771 - bad source code
bad source code
Product: Fedora
Classification: Fedora
Component: mc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2003-11-24 10:28 EST by d.binderman
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: 4.6.0-14.10
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-08-22 20:40:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description d.binderman 2003-11-24 10:28:54 EST
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


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

The source code is

        dir.dent.d_name[MC_MAXPATHLEN] = 0;


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

might be better code.


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):

How reproducible:

Steps to Reproduce:
1. by inspection

Additional info:
Comment 1 Miloslav Trmac 2004-03-11 09:05:26 EST
This looks fine in current CVS version.
Comment 2 Leonard den Ottolander 2004-03-31 11:31:33 EST
This might be fine in current CVS, but should be fixed if an update is

Comment 3 Leonard den Ottolander 2004-03-31 11:35:57 EST
Created attachment 99008 [details]
Patch to correct range
Comment 4 Leonard den Ottolander 2004-05-02 11:57:53 EDT
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 07:00:43 EDT
Please add this patch before releasing the next update!
Comment 6 Leonard den Ottolander 2004-08-22 20:40:04 EDT
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.