From 6b01cf07c2018b7f343b1eb7c32091fe5d8773c4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 29 Mar 2016 02:34:33 -0700 Subject: [PATCH] Use only as much stack as needed for the M23 command --- Marlin/cardreader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index bb2d6e1dd..9dd8a1246 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -266,7 +266,7 @@ void CardReader::release() { } void CardReader::openAndPrintFile(const char *name) { - char cmd[4 + (FILENAME_LENGTH + 1) * MAX_DIR_DEPTH + 2]; // Room for "M23 ", names with slashes, a null, and one extra + char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null sprintf_P(cmd, PSTR("M23 %s"), name); for (char *c = &cmd[4]; *c; c++) *c = tolower(*c); enqueue_and_echo_command_now(cmd);