Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
ssh: Fix router crash when entering key longer than 2047 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
RMerl committed Oct 30, 2015
1 parent a8759e8 commit 014e078
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion release/src/router/rc/ssh.c
Expand Up @@ -30,6 +30,7 @@ char *get_parsed_key(const char *name, char *buf)
value = nvram_safe_get(name);

len = strlen(value);
if (len > 3500) len = 3500;

for (i=0; (i < len); i++) {
if (value[i] == '>')
Expand All @@ -46,7 +47,7 @@ char *get_parsed_key(const char *name, char *buf)
void start_sshd(void)
{
int dirty = 0;
char buf[2048];
char buf[3500];

if (!nvram_match("sshd_enable", "1"))
return;
Expand Down
6 changes: 3 additions & 3 deletions release/src/router/shared/misc.c
Expand Up @@ -898,7 +898,7 @@ int nvram_get_file(const char *key, const char *fname, int max)
}
return r;
/*
char b[2048];
char b[3500];
int n;
char *p;
Expand Down Expand Up @@ -935,8 +935,8 @@ int nvram_set_file(const char *key, const char *fname, int max)
}
return r;
/*
char a[2048];
char b[4096];
char a[3500];
char b[7000];
int n;
if (((n = f_read(fname, &a, sizeof(a))) > 0) && (n <= max)) {
Expand Down

0 comments on commit 014e078

Please sign in to comment.