1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
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:
bors[bot] 2023-01-07 07:45:38 +00:00 committed by GitHub
commit 949db03199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}