diff common-runopts.c @ 1834:94dc11094e26

Increase max window size to 10MB, fallback rather than exiting if an invalid value is given.
author Matt Johnston <matt@codeconstruct.com.au>
date Tue, 12 Oct 2021 23:32:10 +0800
parents f8d8af12ac14
children 8b4274d34fe8
line wrap: on
line diff
--- a/common-runopts.c	Tue Oct 12 23:31:09 2021 +0800
+++ b/common-runopts.c	Tue Oct 12 23:32:10 2021 +0800
@@ -101,4 +101,20 @@
 	fprintf(stderr, "Dropbear v%s\n", DROPBEAR_VERSION);
 }
 
+void parse_recv_window(const char* recv_window_arg) {
+	int ret;
+	unsigned int rw;
 
+	ret = m_str_to_uint(recv_window_arg, &rw);
+	if (ret == DROPBEAR_FAILURE || rw == 0 || rw > MAX_RECV_WINDOW) {
+		if (rw > MAX_RECV_WINDOW) {
+			opts.recv_window = MAX_RECV_WINDOW;
+		}
+		dropbear_log(LOG_WARNING, "Bad recv window '%s', using %d",
+			recv_window_arg, opts.recv_window);
+	} else {
+		opts.recv_window = rw;
+	}
+
+}
+