mirror of
https://github.com/labwc/labwc.git
synced 2026-05-06 06:47:33 -04:00
buf.c: fix -fanalyze warning
../src/common/buf.c:61:28: error: write to string literal [-Werror=analyzer-write-to-string-literal]
61 | *p = '\0';
| ~~~^~~~~~
This commit is contained in:
parent
3632c6703a
commit
f42e1895d4
1 changed files with 6 additions and 7 deletions
|
|
@ -53,15 +53,14 @@ buf_expand_shell_variables(struct buf *s)
|
|||
if (s->data[i] == '$' && isvalid(s->data[i+1])) {
|
||||
/* expand environment variable */
|
||||
buf_clear(&environment_variable);
|
||||
buf_add(&environment_variable, s->data + i + 1);
|
||||
char *p = environment_variable.data;
|
||||
while (isvalid(*p)) {
|
||||
++p;
|
||||
int len = 0;
|
||||
while (isvalid(s->data[i + 1 + len])) {
|
||||
buf_add_char(&environment_variable, s->data[i + 1 + len]);
|
||||
++len;
|
||||
}
|
||||
*p = '\0';
|
||||
i += strlen(environment_variable.data);
|
||||
i += len;
|
||||
strip_curly_braces(environment_variable.data);
|
||||
p = getenv(environment_variable.data);
|
||||
char *p = getenv(environment_variable.data);
|
||||
if (p) {
|
||||
buf_add(&tmp, p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue