projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bd23b22
)
tools/env: Fix variable delete operation
author
Joe Hershberger
<joe.hershberger@ni.com>
Mon, 15 Oct 2012 15:29:24 +0000
(15:29 +0000)
committer
Tom Rini
<trini@ti.com>
Tue, 16 Oct 2012 15:47:27 +0000
(08:47 -0700)
Fix crash introduced by
a073d63a36524453a817ab029fad5b188f46127e
when attempting to delete a variable.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
tools/env/fw_env.c
patch
|
blob
|
history
diff --git
a/tools/env/fw_env.c
b/tools/env/fw_env.c
index ab8c15d30eef712af4679d9aeeb5641a09afd097..97328bb3a8209cf17ec0ec69a7a25dc42e810d3f 100644
(file)
--- a/
tools/env/fw_env.c
+++ b/
tools/env/fw_env.c
@@
-494,6
+494,8
@@
int fw_setenv(int argc, char *argv[])
char *val = argv[i];
size_t val_len = strlen(val);
+ if (value)
+ value[len - 1] = ' ';
value = realloc(value, len + val_len + 1);
if (!value) {
fprintf(stderr,
@@
-504,9
+506,8
@@
int fw_setenv(int argc, char *argv[])
memcpy(value + len, val, val_len);
len += val_len;
- value[len++] = '
';
+ value[len++] = '
\0
';
}
- value[len - 1] = '\0';
fw_env_write(name, value);