summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-03-07 22:16:21 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-03-07 22:16:21 +0800
commitc04cf6354e983d5a494ab1b75093016f371c3f26 (patch)
treef7e65e740de51fba0042575dcc511bd082b2412b
parentbdc991297fd9227ee2de2fa5ba80c1f098e894eb (diff)
downloaddropbear-c04cf6354e983d5a494ab1b75093016f371c3f26.tar.gz
don't allow null characters in authorized_keys
-rw-r--r--svr-authpubkey.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/svr-authpubkey.c b/svr-authpubkey.c
index e97b158..ec14ec0 100644
--- a/svr-authpubkey.c
+++ b/svr-authpubkey.c
@@ -201,7 +201,12 @@ static int checkpubkey_line(buffer* line, int line_num, const char* filename,
if (line->len < MIN_AUTHKEYS_LINE || line->len > MAX_AUTHKEYS_LINE) {
TRACE(("checkpubkey_line: bad line length %d", line->len))
- return DROPBEAR_FAILURE;
+ goto out;
+ }
+
+ if (memchr(line->data, 0x0, line->len) != NULL) {
+ TRACE(("checkpubkey_line: bad line has null char"))
+ goto out;
}
/* compare the algorithm. +3 so we have enough bytes to read a space and some base64 characters too. */