diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-05-31 15:02:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-31 15:02:10 -0400 |
| commit | ce231fbc872650f5ecd2415b99df259fa2f81377 (patch) | |
| tree | 7cd5dbb0a032585ebf53c47ce274735d4a5f06eb /lib/command.c | |
| parent | 4cc136532f31634bda173ce919c0a69605bc7fa7 (diff) | |
| parent | 63e653a21f59a17810d597ec35b20fb13bae6692 (diff) | |
Merge pull request #4430 from lkrishnamoor/hostname_crash
lib: crash when FRR hostname length > 80 chars
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/command.c b/lib/command.c index 5335969fbc..e5e0623163 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1962,7 +1962,15 @@ DEFUN (config_hostname, struct cmd_token *word = argv[1]; if (!isalnum((int)word->arg[0])) { - vty_out(vty, "Please specify string starting with alphabet\n"); + vty_out(vty, + "Please specify string starting with alphabet or number\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + /* With reference to RFC 1123 Section 2.1 */ + if (strlen(word->arg) > HOSTNAME_LEN) { + vty_out(vty, "Hostname length should be less than %d chars\n", + HOSTNAME_LEN); return CMD_WARNING_CONFIG_FAILED; } |
