diff svr-authpubkey.c @ 1610:96e4c9b2cc00 coverity

merge coverity
author Matt Johnston <matt@ucc.asn.au>
date Wed, 21 Mar 2018 00:52:02 +0800
parents dc7c9fdb3716
children 1fbe598a14fb
line wrap: on
line diff
--- a/svr-authpubkey.c	Sun Mar 04 15:07:09 2018 +0800
+++ b/svr-authpubkey.c	Wed Mar 21 00:52:02 2018 +0800
@@ -167,6 +167,10 @@
 		sign_key_free(key);
 		key = NULL;
 	}
+	/* Retain pubkey options only if auth succeeded */
+	if (!ses.authstate.authdone) {
+		svr_pubkey_options_cleanup();
+	}
 	TRACE(("leave pubkeyauth"))
 }
 
@@ -197,7 +201,12 @@
 
 	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. */