apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60191] libapr computes incorrect size for dirent structure
Date Tue, 04 Oct 2016 18:36:28 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60191

--- Comment #4 from Ruediger Pluem <rpluem@apache.org> ---
(In reply to Yann Ylavic from comment #3)
> (In reply to William A. Rowe Jr. from comment #2)
> > Why not
> > 
> > -        (sizeof((*new)->entry->d_name) > 1 ? 0 : 255);
> > +        PATH_MAX+1 - sizeof((*new)->entry->d_name);
> 
> Or maybe:
> 
> +    apr_size_t dname_size = sizeof((*new)->entry->d_name);
>      apr_size_t dirent_size = 
>          sizeof(*(*new)->entry) +
> -        (sizeof((*new)->entry->d_name) > 1 ? 0 : 255);
> +        (d_name_size > PATH_MAX ? dname_size : PATH_MAX + 1) -
> +        dname_size;
> 
> to preserve sizeof(d_name) if it's above PATH_MAX already.

As far as I understand the current calculation and the one Bill proposed can be
done at compile time while yours need to be done at runtime. Probably using a
#define dname_size could fix this.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message