Skip to content

Commit

Permalink
Appending the copied env string with NULL character for correct behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Gautham Kuppuswamy <gkuppuswamy@rocketsoftware.com>
  • Loading branch information
Gautham-coder committed Jun 18, 2024
1 parent defc878 commit f40ce5e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ static const char **env_comp(zl_comp_t *comp) {
char *thisEnv = *env;
char *aux = malloc(strlen(thisEnv) + 1);
strncpy(aux, thisEnv, strlen(thisEnv));
aux[strlen(thisEnv)] = '\0';
trimRight(aux, strlen(aux));
env_comp[i] = aux;
i++;
Expand Down

0 comments on commit f40ce5e

Please sign in to comment.