Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.zx2c4.com/cgit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'shared.c')
-rw-r--r--shared.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/shared.c b/shared.c
index f7b64cf..609bd2a 100644
--- a/shared.c
+++ b/shared.c
@@ -476,15 +476,16 @@ static int is_token_char(char c)
static char *expand_macro(char *name, int maxlength)
{
char *value;
- int len;
+ size_t len;
len = 0;
value = getenv(name);
if (value) {
- len = strlen(value);
+ len = strlen(value) + 1;
if (len > maxlength)
len = maxlength;
- strncpy(name, value, len);
+ strlcpy(name, value, len);
+ --len;
}
return name + len;
}