Skip to content

Buffer overflows #5

@rercek

Description

@rercek

Hello,

FYI, this library has a systematic buffer overflow when you read a register with readReg. Indeed, the variable buf should have a length of 3 bytes and not only 2 bytes. Third byte is used for CRC8 in readReg function. For example

float DFRobot_MLX90614::getAmbientTempCelsius(void) {
 uint8_t buf[3]; //3 and not 2 !
 readReg(MLX90614_TA, buf);
 ...

Here is the corrected code with the following improvements:

  • Fixed bug related to buffer overflows when reading registers.
  • Write a new value to a register only if that value is not already set (read before write).
  • New read (and/or write) functions for Emissivity, FIR, IIR, Gain and Raw Temperatures!

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions