projects
/
adu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6b77f83
)
Fix a bug in exec_interactive_command().
author
Andre Noll
<maan@systemlinux.org>
Sat, 1 Nov 2008 21:18:58 +0000
(22:18 +0100)
committer
Andre Noll
<maan@systemlinux.org>
Sat, 1 Nov 2008 21:18:58 +0000
(22:18 +0100)
In case a command iwthout further options was given, p pointed one
byte after the malloced string, and this pointer is passed to the
command handler..
interactive.c
patch
|
blob
|
history
diff --git
a/interactive.c
b/interactive.c
index 93e4a36b46e66a6481cc70afb91e562b0a26b5ff..191e6330f3989995ab93c42252f8a7f1d78ad2dd 100644
(file)
--- a/
interactive.c
+++ b/
interactive.c
@@
-99,8
+99,12
@@
static int exec_interactive_command(char *line)
char *p = cmd + strcspn(cmd, delim);
int ret = -E_SYNTAX;
- *p = '\0';
- p++;
+ if (*p == '\0')
+ p = NULL;
+ else {
+ *p = '\0';
+ p++;
+ }
for (i = 0; icmds[i].name; i++) {
ERROR_LOG("name: %s, cmd: %s.\n", icmds[i].name, cmd);
if (strcmp(icmds[i].name, cmd))