mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-08 12:30:40 +00:00
Fix for out of bounds access
Fix for out of bounds access by limiting the printing to the size limit of the buffer
This commit is contained in:
parent
08503a20be
commit
2a2acf62ed
@ -150,7 +150,7 @@ packetbuf_copyto(void *to)
|
|||||||
PRINTF("packetbuf_write: header: %s\n", buffer);
|
PRINTF("packetbuf_write: header: %s\n", buffer);
|
||||||
bufferptr = buffer;
|
bufferptr = buffer;
|
||||||
bufferptr[0] = 0;
|
bufferptr[0] = 0;
|
||||||
for(i = bufptr; ((i < buflen + bufptr) && (bufferlen < 980)); ++i) {
|
for(i = bufptr; ((i < buflen + bufptr) && (bufferlen < (sizeof(buffer) - 10))); ++i) {
|
||||||
bufferlen += sprintf(bufferptr + bufferlen, "0x%02x, ", packetbufptr[i]);
|
bufferlen += sprintf(bufferptr + bufferlen, "0x%02x, ", packetbufptr[i]);
|
||||||
}
|
}
|
||||||
PRINTF("packetbuf_write: data: %s\n", buffer);
|
PRINTF("packetbuf_write: data: %s\n", buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user