Skip to content

Use PATH_MAX for $INCLUDE path resolution#133

Open
mykhailopopivniak wants to merge 1 commit into
FreeRADIUS:masterfrom
mykhailopopivniak:dict-path-max
Open

Use PATH_MAX for $INCLUDE path resolution#133
mykhailopopivniak wants to merge 1 commit into
FreeRADIUS:masterfrom
mykhailopopivniak:dict-path-max

Conversation

@mykhailopopivniak

Copy link
Copy Markdown
Contributor

rc_read_dictionary() resolved relative $INCLUDE paths into a fixed 64-byte buffer (AUTH_ID_LEN). Since AUTH_ID_LEN is sized for attribute names, not file paths, a parent directory longer than ~60 characters caused snprintf to silently truncate the joined path; the recursive fopen() then failed with a misleading "couldn't open dictionary" error.

Size the buffer at PATH_MAX instead, and return an explicit error if the joined path would still exceed it rather than loading the wrong file.

rc_read_dictionary() resolved relative $INCLUDE paths into a fixed
64-byte buffer (AUTH_ID_LEN). Since AUTH_ID_LEN is sized for
attribute names, not file paths, a parent directory longer than
~60 characters caused snprintf to silently truncate the joined path;
the recursive fopen() then failed with a misleading "couldn't open
dictionary" error.

Size the buffer at PATH_MAX instead, and return an explicit error if
the joined path would still exceed it rather than loading the wrong
file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant