Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow max names of 255 characters #392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/path/canon.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static inline void pop_component(char *path)
*
* - 0 otherwise.
*/
static inline Finality next_component(char component[NAME_MAX], const char **cursor)
static inline Finality next_component(char component[NAME_MAX+1], const char **cursor)
{
const char *start;
ptrdiff_t length;
Expand All @@ -103,7 +103,7 @@ static inline Finality next_component(char component[NAME_MAX], const char **cur
(*cursor)++;
length = *cursor - start;

if (length >= NAME_MAX)
if (length > NAME_MAX)
return -ENAMETOOLONG;

/* Extract the component. */
Expand Down Expand Up @@ -224,7 +224,7 @@ int canonicalize(Tracee *tracee, const char *user_path, bool deref_final,
finality = NOT_FINAL;
while (!IS_FINAL(finality)) {
Comparison comparison;
char component[NAME_MAX];
char component[NAME_MAX+1];

finality = next_component(component, &cursor);
status = (int) finality;
Expand Down
2 changes: 1 addition & 1 deletion src/path/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* to @result.
*/
Action readlink_proc(const Tracee *tracee, char result[PATH_MAX],
const char base[PATH_MAX], const char component[NAME_MAX],
const char base[PATH_MAX], const char component[NAME_MAX+1],
Comparison comparison)
{
const Tracee *known_tracee;
Expand Down
2 changes: 1 addition & 1 deletion src/path/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef enum {


extern Action readlink_proc(const Tracee *tracee, char result[PATH_MAX], const char path[PATH_MAX],
const char component[NAME_MAX], Comparison comparison);
const char component[NAME_MAX+1], Comparison comparison);

extern ssize_t readlink_proc2(const Tracee *tracee, char result[PATH_MAX], const char path[PATH_MAX]);

Expand Down