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 Fri, 30 Sep 2016 21:06:07 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60191

--- Comment #3 from Yann Ylavic <ylavic.dev@gmail.com> ---
(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.

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