marlin
"String is truncated when SDSUPPORT is enabled
Positioning of string terminator to truncate checksum from the commands is off by one, causing the last letter of the actual command to be truncated instead of just the checksum. This caused checksummed commands targeting existing files to fail since the last letter of the filename was truncated. Issue 520 on Octoprint though it is a Marlin bug: https://github.com/foosel/OctoPrint/issues/520 Discussion thread: https://groups.google.com/forum/#!topic/octoprint/C7e_HRaflUM"
Bug fixed by commit 2d22902d080
Type | BehaviorViolation |
Config | "SDSUPPORT" (1st degree) |
Fix-in | code |
Location | main |
#include <string.h> static char *strchr_pointer = "eiffel~1.gco*57"; void process_commands() { char *starpos = NULL; #ifdef SDSUPPORT starpos = (strchr(strchr_pointer + 4,'*')); if(starpos!=NULL) *(starpos-1)='\0'; //ERROR assert(strcmp(strchr_pointer,"eiffel~1.gco")); #endif } int main(int argc, char** argv) { process_commands(); return 0; }
diff --git a/simple/2d22902.c b/simple/2d22902.c --- a/simple/2d22902.c +++ b/simple/2d22902.c @@ -8,7 +8,7 @@ void process_commands() #ifdef SDSUPPORT starpos = (strchr(strchr_pointer + 4,'*')); if(starpos!=NULL) - *(starpos-1)='\0'; //ERROR + *(starpos)='\0'; #endif }
#include <string.h> int main(int argc, char** argv) { static char *strchr_pointer = "eiffel~1.gco*57"; char *starpos = NULL; #ifdef SDSUPPORT starpos = (strchr(strchr_pointer + 4,'*')); if(starpos!=NULL) *(starpos-1)='\0'; //ERROR #endif return 0; }
. call Marlin_main.cpp:1155: void process_commands() . 1635: else if(code_seen('M')) . ERROR 1696: *(starpos-1)='\0';