patch from Stefan Kratochwil <entwicklung@inovel.de> : canfestival-3-fm3_698.patch
Bug:
If an object dictionary entry was requested whose size exceeds
SDO_MAX_LENGTH_TRANSFERT, the memcpy() call at line 139 of objacces.c overwrites
the memory after *pDestData which causes stack corruption.
-> Bugfix:
The bug was corrected by size checking the requested data. An 'Out of
memory' error message will be generated if the requested data exceeds
SDO_MAX_LENGTH_TRANSFERT.
Additional changes:
Added dynamic buffer allocation for the SDO transfer. This feature can be used
if SDO_DYNAMIC_BUFFER_ALLOCATION is defined in config.h. The size of the
dynamically allocated buffer is controlled with
SDO_DYNAMIC_BUFFER_ALLOCATION_SIZE.
-> Note:
This change removes the detection of OD_LENGTH_DATA_INVALID errors!
/* File generated by gen_cfile.py. Should not be modified. */
#include "data.h"
/* Prototypes of function provided by object dictionnary */
UNS32 gene_SYNC_valueRangeTest (UNS8 typeValue, void * value);
const indextable * gene_SYNC_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks);
/* prototypes of function to be filled by app. */
void gene_SYNC_heartbeatError(CO_Data* d, UNS8);
UNS8 gene_SYNC_canSend(Message *);
void gene_SYNC_initialisation(CO_Data* d);
void gene_SYNC_preOperational(CO_Data* d);
void gene_SYNC_operational(CO_Data* d);
void gene_SYNC_stopped(CO_Data* d);
void gene_SYNC_post_sync(CO_Data* d);
void gene_SYNC_post_TPDO(CO_Data* d);
/* Master node data struct */
extern CO_Data gene_SYNC_Data;
extern UNS16 acceptanceFilter1; /* Mapped at index 0x2015, subindex 0x00*/
extern UNS16 acceptanceFilter2; /* Mapped at index 0x2016, subindex 0x00*/
extern UNS16 acceptanceFilter3; /* Mapped at index 0x2017, subindex 0x00*/
extern UNS16 acceptanceFilter4; /* Mapped at index 0x2018, subindex 0x00*/
extern UNS16 mask1; /* Mapped at index 0x2019, subindex 0x00*/
extern UNS16 mask2; /* Mapped at index 0x2020, subindex 0x00*/
extern UNS16 mask3; /* Mapped at index 0x2021, subindex 0x00*/
extern UNS16 mask4; /* Mapped at index 0x2022, subindex 0x00*/
extern UNS8 applyDownloadedFilters; /* Mapped at index 0x2023, subindex 0x00*/