If you've mistakenly put a space before typing in a command, the
leading space will be included as part of the command, and the command
parser will not find the corresponding command. This patch rectifies
that situation by stripping the leading spaces on commands.
Review: https://reviewboard.asterisk.org/r/2709/
Patch-by: Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@396745
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
ret = 1;
}
+ while (isspace(*s)) {
+ s++;
+ }
+
if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
(s[4] == '\0' || isspace(s[4]))) {
quit_handler(0, SHUTDOWN_FAST, 0);
return NULL;
cur = duplicate;
+
+ /* Remove leading spaces from the command */
+ while (isspace(*s)) {
+ cur++;
+ s++;
+ }
+
/* scan the original string copying into cur when needed */
for (; *s ; s++) {
if (x >= max - 1) {