AP_HAL_PX4: fix possible overflow/truncation issue

bus_id is declared to be a 5 bit value, so 2 digits are necessary for
string representation.
This commit is contained in:
Holger Steinhaus 2018-03-16 21:46:30 +01:00
parent 5af02dde59
commit 8b8a99e1aa
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ void *DeviceBus::bus_thread(void *arg)
struct DeviceBus *binfo = (struct DeviceBus *)arg;
// setup a name for the thread
char name[] = "XXX:X";
char name[] = "XXX:XX";
switch (binfo->hal_device->bus_type()) {
case AP_HAL::Device::BUS_TYPE_I2C:
snprintf(name, sizeof(name), "I2C:%u",

View File

@ -34,8 +34,8 @@ private:
static pthread_mutex_t instance_lock;
bool init_done;
bool init_ok;
char devname[10];
char devpath[14];
char devname[11];
char devpath[15];
};