Skip to content

Commit

Permalink
Abort sending thumbnail data if a space is seen in it
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Feb 22, 2022
1 parent 39308c1 commit 36c6c6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Platform/RepRap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,10 @@ OutputBuffer *RepRap::GetThumbnailResponse(const char *filename, FilePosition of
}

// Check for end of thumbnail. We'd like to use a regex here but we can't afford the flash space of a regex parser in some build configurations.
if (StringStartsWith(p, "thumbnail end") || StringStartsWith(p, "thumbnail_QOI end")|| StringStartsWith(p, "thumbnail_JPG end"))
if ( StringStartsWith(p, "thumbnail end") || StringStartsWith(p, "thumbnail_QOI end")|| StringStartsWith(p, "thumbnail_JPG end")
// Also stop if the base64 data has ended, to avoid sending to the end of file if the end marker is missing. We don't want to take too long so just look for space.
|| strchr(p, ' ') != nullptr
)
{
offset = 0;
break;
Expand Down

0 comments on commit 36c6c6d

Please sign in to comment.