Skip to content

SDO upload of strings #171

@jafem

Description

@jafem

To start an SDO upload, the buffer size must be specified in COCSdoRequestUpload.

CO_ERR COCSdoRequestUpload(CO_CSDO *csdo,
                           uint32_t key,
                           uint8_t *buf,
                           uint32_t size,
                           CO_CSDO_CALLBACK_T callback,
                           uint32_t timeout)

For uploading null-terminated strings the transferred object size depends on the position of the Nul terminator. Without knowing the exact string size in advance, the upload will fail.

I adapted the size check obj_size == csdo->Tfer.Size to obj_size <= csdo->Tfer.Size in COCSdoInitUploadSegmented to overcome this issue.

static CO_ERR COCSdoInitUploadSegmented(CO_CSDO *csdo)
{
    ...

    /* verify size, Idx, Sub */
    if ((obj_size <= csdo->Tfer.Size) &&
        (Idx == csdo->Tfer.Idx) &&
        (Sub == csdo->Tfer.Sub)) {

       ...

   }
 
   ...
}

Is this modification permissible or are there side effects?

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