adafruit / adafruit/Adafruit_Learning_System_Guides
revisiting #1091 on Feather_ePaper_Quotes
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.1k
- Forks
- 806
- Avg merge
- 16h 52m
- Merged PRs (30d)
- 11
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Feather_ePaper_Quotes at the buffer declaration and strcpy() around line 93, using the linked guide and prior issue #1091 for context. Verify that long quote strings cannot overflow the buffer while ordinary quotes still display correctly; the issue does not name a test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100