diff options
author | Eike Rathke <erack@redhat.com> | 2013-03-30 19:23:55 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-03-30 19:39:29 +0100 |
commit | 2cd4e55bb36a9a3d13971b530469188e3fb59dfe (patch) | |
tree | 900749adfc02ef6c2bcba81c3f61e4e0939484df /vcl | |
parent | 31fa0633795e681035f7b9cda5747c9e2af28665 (diff) |
certainly this was not meant to be _PC_NAME_MAX
_PC_NAME_MAX is a symbolic constant meant to be used as a pathconf()
argument, not a buffer length.
This piece of code was even "honored" in
http://womble.decadent.org.uk/readdir_r-advisory.html
"The code that enumerates fonts and plugins in the appropriate
directories uses a stack buffer of type long[sizeof(struct dirent) +
_PC_NAME_MAX + 1]. I can only assume this is the result of a programmer
cutting his crack with aluminium filings."
Thanks to Heiner Rechtien for pointing this out.
Note: declaring the buffer of type long instead of char looks weird but
probably has the reason that it is casted to struct dirent* for the
readdir_r() call that might not work on architectures that forbid
arbitrary alignment on non-even boundaries.
Change-Id: Ie959b8905d1328c6fcaefbf6f6c915cc430e85b6
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/fontmanager/fontmanager.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index c5a52f71afce..de66c528e493 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -1637,7 +1637,7 @@ void PrintFontManager::initialize() CALLGRIND_ZERO_STATS(); #endif - long aDirEntBuffer[ (sizeof(struct dirent)+_PC_NAME_MAX)+1 ]; + long aDirEntBuffer[ (sizeof(struct dirent)+PATH_MAX)+1 ]; if( ! m_pFontCache ) { |