]> git.cameronkatri.com Git - cgit.git/blobdiff - shared.c
Bump version.
[cgit.git] / shared.c
index f7b64cf317ced6a7dd5ce33fce48e74c149c0e5f..609bd2a30670e5eab7974593fd98c6d9e95c24bc 100644 (file)
--- 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;
 }