diff --git a/common-algo.c b/common-algo.c
index 45adecbe05b517d96021ddb0268a23f09ec995b4..71b1c6a0500a2590a87806391ef761a3ed6297c6 100644
--- a/common-algo.c
+++ b/common-algo.c
@@ -210,7 +210,7 @@ int have_algo(char* algo, size_t algolen, algo_type algos[]) {
 void buf_put_algolist(buffer * buf, algo_type localalgos[]) {
 
 	unsigned int pos = 0, i, len;
-	char str[50]; /* enough for local algo storage */
+	char str[MAX_ALGO_LIST_LEN];
 
 	for (i = 0; localalgos[i].name != NULL; i++) {
 		if (localalgos[i].usable) {
diff --git a/options.h b/options.h
index 5ec19fc5f7c3a51a1d7055f9b8e9f7a2dbcacea6..25cfa8b8dfd7b5d5cd9ffed54f78e4f51925069a 100644
--- a/options.h
+++ b/options.h
@@ -289,6 +289,9 @@ etc) slower (perhaps by 50%). Recommended for most small systems. */
 
 #define MAX_PROPOSED_ALGO 20
 
+#define MAX_ALGO_LIST_LEN 100 /* max length of our sent algorithm list
+								 (cipher is longest) */
+
 /* size/count limits */
 #define MAX_LISTEN_ADDR 10