1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-25 17:41:19 +02:00

35231: make mkevnstr() safe for NULL value

This commit is contained in:
Barton E. Schaefer 2015-05-20 10:14:04 -07:00
parent 9584c76fb7
commit af957f2ed6
2 changed files with 13 additions and 5 deletions

View file

@ -3,6 +3,10 @@
* Ismail: 35232: Completion/Unix/Type/_urls: matching
parentheses.
2015-05-20 Barton E. Schaefer <schaefer@zsh.org>
* 35231: Src/params.c: make mkevnstr() safe for NULL value
2015-05-19 Daniel Shahaf <d.s@daniel.shahaf.name>
* 35224: Completion/Unix/Command/_git: completion: git: Add

View file

@ -4580,17 +4580,21 @@ addenv(Param pm, char *value)
static char *
mkenvstr(char *name, char *value, int flags)
{
char *str, *s;
int len_name, len_value;
char *str, *s = value;
int len_name, len_value = 0;
len_name = strlen(name);
for (len_value = 0, s = value;
*s && (*s++ != Meta || *s++ != 32); len_value++);
if (s)
while (*s && (*s++ != Meta || *s++ != 32))
len_value++;
s = str = (char *) zalloc(len_name + len_value + 2);
strcpy(s, name);
s += len_name;
*s = '=';
copyenvstr(s, value, flags);
if (value)
copyenvstr(s, value, flags);
else
*++s = '\0';
return str;
}