From dd9ee3f4f81de5f66a6481ec921282b345705492 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja.osipov@gmail.com> Date: Tue, 24 May 2011 18:44:58 +0400 Subject: [PATCH] Bug#716683 "Admin console hangs on unknown command" Review fixes: the original patch is fine, but since we use strlen() for help, let's use strlen() for unknown_command too. --- core/admin.c | 4 ++-- core/admin.rl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/admin.c b/core/admin.c index d521a99158..3e5ddfe721 100644 --- a/core/admin.c +++ b/core/admin.c @@ -58,7 +58,7 @@ static const char *help = " - reload configuration" CRLF; -static const char unknown_command[] = "unknown command. try typing help." CRLF; +static const char *unknown_command = "unknown command. try typing help." CRLF; #line 65 "core/admin.c" @@ -1457,7 +1457,7 @@ case 107: if (p != pe) { start(out); - tbuf_append(out, unknown_command, sizeof(unknown_command) - 1); + tbuf_append(out, unknown_command, strlen(unknown_command)); end(out); } diff --git a/core/admin.rl b/core/admin.rl index 514b467a4f..bed4f22a8d 100644 --- a/core/admin.rl +++ b/core/admin.rl @@ -56,7 +56,7 @@ static const char *help = " - reload configuration" CRLF; -static const char unknown_command[] = "unknown command. try typing help." CRLF; +static const char *unknown_command = "unknown command. try typing help." CRLF; %%{ machine admin; @@ -203,7 +203,7 @@ admin_dispatch(void) if (p != pe) { start(out); - tbuf_append(out, unknown_command, sizeof(unknown_command) - 1); + tbuf_append(out, unknown_command, strlen(unknown_command)); end(out); } -- GitLab