mirror of
https://github.com/labwc/labwc.git
synced 2026-05-07 12:06:30 -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])) {
|
if (s->data[i] == '$' && isvalid(s->data[i+1])) {
|
||||||
/* expand environment variable */
|
/* expand environment variable */
|
||||||
buf_clear(&environment_variable);
|
buf_clear(&environment_variable);
|
||||||
buf_add(&environment_variable, s->data + i + 1);
|
int len = 0;
|
||||||
char *p = environment_variable.data;
|
while (isvalid(s->data[i + 1 + len])) {
|
||||||
while (isvalid(*p)) {
|
buf_add_char(&environment_variable, s->data[i + 1 + len]);
|
||||||
++p;
|
++len;
|
||||||
}
|
}
|
||||||
*p = '\0';
|
i += len;
|
||||||
i += strlen(environment_variable.data);
|
|
||||||
strip_curly_braces(environment_variable.data);
|
strip_curly_braces(environment_variable.data);
|
||||||
p = getenv(environment_variable.data);
|
char *p = getenv(environment_variable.data);
|
||||||
if (p) {
|
if (p) {
|
||||||
buf_add(&tmp, p);
|
buf_add(&tmp, p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue