Skip to content

Commit

Permalink
Merge pull request #116 from fischerling/fix-expand-env
Browse files Browse the repository at this point in the history
fix __expand_env not passing the input string length
  • Loading branch information
Galfurian authored Dec 5, 2024
2 parents 4b8758a + 8dc5a66 commit 4cd7ea9
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 4cd7ea9

Please sign in to comment.