mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge #19107
19107: drivers/ws281x: fix out-of-bounds read on native r=aabadie a=benpicco Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
This commit is contained in:
commit
949db03199
@ -26,10 +26,10 @@ void ws281x_write_buffer(ws281x_t *dev, const void *buf, size_t size)
|
||||
(void) dev;
|
||||
const uint8_t *src = buf;
|
||||
|
||||
for (unsigned i = 0; i < size; ++i) {
|
||||
int r = src[WS281X_BYTES_PER_DEVICE * i + WS281X_OFFSET_R];
|
||||
int g = src[WS281X_BYTES_PER_DEVICE * i + WS281X_OFFSET_G];
|
||||
int b = src[WS281X_BYTES_PER_DEVICE * i + WS281X_OFFSET_B];
|
||||
for (unsigned i = 0; i < size; i += WS281X_BYTES_PER_DEVICE) {
|
||||
int r = src[i + WS281X_OFFSET_R];
|
||||
int g = src[i + WS281X_OFFSET_G];
|
||||
int b = src[i + WS281X_OFFSET_B];
|
||||
printf("\033[48;2;%d;%d;%dm ", r, g, b);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user