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

fix __expand_env not passing the input string length #116

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
4 changes: 2 additions & 2 deletions programs/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ static char *__getenv(const char *var)

/// @brief Expands environmental variables in a string and stores the result in the buffer.
/// @param str The input string containing potential environmental variables.
/// @param str_len The length of the input string.
/// @param buf The buffer where the expanded string will be stored.
/// @param buf_len The maximum length of the buffer.
/// @param str_len The length of the input string (if provided, otherwise it will be calculated).
/// @param null_terminate If true, the resulting buffer will be null-terminated.
static void ___expand_env(char *str, size_t str_len, char *buf, size_t buf_len, bool_t null_terminate)
{
Expand Down Expand Up @@ -385,7 +385,7 @@ static void ___expand_env(char *str, size_t str_len, char *buf, size_t buf_len,
/// @param buf_len The size of the buffer.
static void __expand_env(char *str, char *buf, size_t buf_len)
{
___expand_env(str, 0, buf, buf_len, false);
___expand_env(str, strlen(str), buf, buf_len, false);
}

/// @brief Sets environment variables based on arguments.
Expand Down
Loading