review request: 7114611 - SIGBUS in readdir64_r

Dean Long dean.long at oracle.com
Tue Jan 24 23:29:46 PST 2012


Using name_extra[PATH_MAX + 1] would reserve more space than needed.
The suggested fix that I contributed results in something like:

       struct {
         struct /* dirent64 */ {
           /* ... */|
           char d_name[256 /* unspecified */];
         } buf;
|         char name_extra[PATH_MAX + 1 - sizeof result->d_name];
       } entry;

When you combine the adjacent buf.d_name[] and name_extra[], you get
PATH_MAX + 1 char's.  But that is already more than enough.
I chose PATH_MAX + 1 because that's what the old code did,
but according to the spec only NAME_MAX + 1 char's need to be reserved.

dl

http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir_r.html

On 1/24/2012 8:42 PM, Vladimir Danushevsky wrote:
> cc'ing nio-dev at openjdk.java.net <mailto:nio-dev at openjdk.java.net>
>
> I'm not sure regarding name_extra char array size calculation. Does it 
> need to bejust (PATH_MAX+1) instead?
>
> On Jan 24, 2012, at 4:08 PM, Carlos Lucasius wrote:
>
>> http://javaweb.us.oracle.com/~clucasiu/webrevs/7114611/webrev.00/
>>
>> Thanks,
>>
>> /-/Carlos
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20120124/f9d2629c/attachment.html 


More information about the nio-dev mailing list