* PATH_MAX + 1 in realpath_not_final()
@ 2021-09-07 10:38 Petr Lautrbach
0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2021-09-07 10:38 UTC (permalink / raw)
To: selinux
Hello,
I was asked whether is there a reason for "Resolved path must be a path
of size PATH_MAX + 1" in the comment assigned to real_path_not_final()
in selinux.h [1]?
/* Resolve all of the symlinks and relative portions of a pathname, but NOT
* the final component (same a realpath() unless the final component is a
* symlink. Resolved path must be a path of size PATH_MAX + 1 */
extern int realpath_not_final(const char *name, char *resolved_path);
Looking into libselinux/src/matchpathcon.c:
423 │ len = strlen(p);
424 │ if (len + strlen(last_component) + 2 > PATH_MAX) {
425 │ │ myprintf("symlink_realpath(%s) failed: Filename too long \n",
426 │ │ │ name);
427 │ │ errno = ENAMETOOLONG;
428 │ │ rc = -1;
429 │ │ goto out;
430 │ }
it seems to be that PATH_MAX should be enough? Am I missing something?
[1] https://github.com/SELinuxProject/selinux/blob/master/libselinux/include/selinux/selinux.h#L493
Thanks,
Petr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-07 10:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 10:38 PATH_MAX + 1 in realpath_not_final() Petr Lautrbach
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.