From: Soeren D. S. <soe...@gm...> - 2005-10-16 13:41:51
|
Sam Steingold schrieb: >>* Soeren D. Schulze <fbrera.q.fpuhymr@tzk.qr> [2005-10-15 15:49:14 +0200]: >> >>there was the issue that GNU/Hurd does not define MAXPATHLEN. >> >>This is not a bug in GNU/Hurd, as POSIX does not require MAXPATHLEN and >>neither do the GNU Coding Standards. For major parts of the code, the >>existence of MAXPATHLEN is asserted by an #ifndef clause. > > > thanks. > what is the difference between MAXPATHLEN and MAX_PATH? > (and what is the latter's value on hurd?) I don't know about the difference. I assume it is equivalent. GNU libc's realpath uses PATH_MAX, at least, if defined by the system, they say in the documentation. GNU philosophy is, however, that there should be no limits at all. So under GNU/Hurd, neither MAXPATHLEN nor MAX_PATH are defined. Right now this makes me ponder about other uses of MAXPATHLEN in CLisp because CLisp defines MAXPATHLEN itself in the .d files. The point is that if you define MAXPATHLEN yourself but realpath thinks there are no limits, couldn't this cause a buffer overflow? I will have to check where MAXPATHLEN is also used and if there are functions that behave differently if MAXPATHLEN is undefined on the system -- like realpath. Another problem is that my patch does an assumption: that if MAXPATHLEN is undefined, realpath supports being called with NULL. This is the case for all the systems I know (GNU/Hurd being the only system that does not define MAXPATHLEN), but if one tries to compile it on a system that does not fit this assumption, it will create a subtle runtime error. In any case, beware removing the "# ifdef MAXPATHLEN" case. This would introduce a build error for all systems that do not support realpath being called with NULL. Nevertheless, if you have reviewed the patch and you think it works, it is probably safe to apply it as it will not affect other systems being currently supported. Sören |