Browse Source

HAL_AVR: ensure we can handle a 256 size buffer

master
Andrew Tridgell 12 years ago
parent
commit
0cb8192861
  1. 2
      libraries/AP_HAL_AVR/UARTDriver.cpp

2
libraries/AP_HAL_AVR/UARTDriver.cpp

@ -241,7 +241,7 @@ bool AVRUARTDriver::_allocBuffer(Buffer *buffer, uint16_t size) @@ -241,7 +241,7 @@ bool AVRUARTDriver::_allocBuffer(Buffer *buffer, uint16_t size)
buffer->mask = mask;
// allocate memory for the buffer - if this fails, we fail.
buffer->bytes = (uint8_t *) malloc(buffer->mask + 1);
buffer->bytes = (uint8_t *) malloc(buffer->mask + (size_t)1);
return (buffer->bytes != NULL);
}

Loading…
Cancel
Save