Skip to content

revisiting #1091 on Feather_ePaper_Quotes #1127

@TonyLHansen

Description

@TonyLHansen

The "reopen button" is not available. Regarding #1091, which is about Feather_ePaper_Quotes, found in https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/Feather_ePaper_Quotes and as described in https://learn.adafruit.com/epaper-display-featherwing-quote-display. The "fix" that was merged previously for this changed one fixed-length buffer for a slightly larger one. Instead of fixing the problem, it just postpones it until the new buffer size overflows.

I suggest you also change the strcpy() statement a few lines after the declaration on line 93

static char buff[1024];
. . .
strcpy(buff,str);

to this:

static char buff[512];
. . .
if (strlen(str) >= sizeof(buff)-1) { // protect against buffer overflow
strncpy(buff, str, sizeof(buff)-2);
buff[sizeof(buff)-1] = '\0';
} else {
strcpy(buff,str);
}

That will future proof the code.

Because of the small memory on the microcontroller, I also drop the size of buff back down a bit so you don't have such a large buffer floating around that is empty most of the time.

I'll put together a PR with this fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions