Hi, Bernhard

> Message du 04/03/08 21:47
> De : "Bernhard Kaindl" <[EMAIL PROTECTED]>
> A : "Jean-Pierre André" <[EMAIL PROTECTED]>
> Copie à : [email protected]
> Objet : [ntfs-3g-devel] [PATCH] For review: Fix for crash if $INDEX_ROOT is  
> not found
> 
> Bonjour Jean-Pierre,
> 
>  I started playing around with your latest NTFS-3G release with support
> for file ownership and permissions from
> 
>       http://pagesperso-orange.fr/b.andre/security.html
> 
>       http://pagesperso-orange.fr/b.andre/ntfs-3g-1.2129SR.1.tgz
> 
> and started off with an already used NTFS volume which I created using mkntfs
> from ntfsprogs. I saw warnings of ntfs-3g not findig $Secure and after 
> creating
> it by hand as a normal file, I tried

Which NTFS format version was built by mkntfs ?

This information is written to the system log, in the following
example it is 3.1

Version 1.2216SR.1 integrated FUSE 27
Mounted /dev/sdb1 (Read-Write, label "ntfs-try", NTFS 3.1)
Cmdline options: rw,nosuid,nodev,uhelper=hal,locale=en_US.UTF-8 

If $Secure is missing, you could be using a version meant for
NT3. However the version is checked and using an old version
should not lead to using $Secure.

If you are using NTFS 3.x I may have to build the $Secure after
the first mount.

> 
>       vim /ntfs/.NTFS-3G/UserMapping
> 
> and got a crash. The cause seems to have been that it also appears to need
> $INDEX_ROOT which it also didn't find until I created it by with touch.
> I Started ntfs-3g in the debugger and saw that the cause was that

$Secure is a complex file with two indexes, the lack of $INDEX_ROOT
is a consequence of $Secure missing. You obviously cannot create a
valid structure by just touching $Secure


> 
>               xsdh->entry
> 
> as returned by was zero ntfs_index_lookup() and it was deferenced without
> further check before dereferencing it.
> 
> I only assume that missing $INDEX_ROOT played a role in this crash because
> it was the error message which ntfs_index_lookup() printed before returning
> the zero xsdh->entry.

Sure.

Testing the presence of $Secure should have prevented the
execution to go through a wrong path.

Thank you for pointing this out.


> 
> I saw that ntfs_index_lookup() does not touch xsdh->entry if the lookup
> fails, so I added a check to abort the function in that case. Please find
> the patch which I created for verification and testing below.
> 
> It also adds a return value check to another place where ntfs_index_lookup()
> is used in a similar way. There are two more places which do not check the
> return vaule but they contain check of (* ntfs_index_context)->entry before
> it is dereferenced, and I am not sure what would be the best way to handle
> the found/not found return value from ntfs_index_lookup() in these places.
> 
> The patch below also contains a change to the header file to add
> 
>       __attribute__ ((__warn_unused_result__))
> 
> to the declaration of ntfs_index_lookup() if gcc-3.4 or newer is used. So
> if you use a compiler like that, you'll the the warnings which are generated
> as a result.

Thank you for the suggestion. These patches will be included in
next release.

Regards

Jean-Pierre



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to