Changeset 72 in pacpussensors for trunk/Sick/SickLDMRSSensor.cpp


Ignore:
Timestamp:
Dec 4, 2014, 1:02:02 PM (10 years ago)
Author:
DHERBOMEZ Gérald
Message:
  • Correction of a little bug in gps component (property recording bad)
  • Improvement of sick lms151 component
  • Correction of bug in sick LDRMS : buffer overflow in a memcpy
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Sick/SickLDMRSSensor.cpp

    r71 r72  
    322322        // we have a complete message available that we can add to the list
    323323        MessageLDMRS msg;
    324         memcpy(msg.body, pendingBytes.data.c_str() + index, msgSize);
    325 
     324                if (msgSize <= sizeof(msg.body))
     325                        memcpy(msg.body, pendingBytes.data.c_str() + index, msgSize);
     326                else
     327                        LOG_ERROR("Impossible to copy the pending bytes in the MessageLDMRS, checked the size of the body in the code! Data might be corrupted...");
    326328//        msg->body = messageData;
    327329
Note: See TracChangeset for help on using the changeset viewer.