Skip to content

CFE_SB_GetLastSenderID returns pointer to internal data, possible race #608

@skliper

Description

@skliper

Describe the bug
CFE_SB_GetLastSenderID returns pointer to data that could be overwritten at any time

See #605 (comment) for related comments

To Reproduce
Conceptually - app calls CFE_SB_GetLastSenderID, gets pointer, data gets overwritten, app takes action based on overwritten data vs original context

Expected behavior
No race.

Code snips

/* Get ptr to buffer descriptor for the last msg received on the given pipe */
Ptr2BufDescriptor = CFE_SB.PipeTbl[PipeId].CurrentBuff;
/* Set the receivers pointer to the adr of 'Sender' struct in buf descriptor */
*Ptr = (CFE_SB_SenderId_t *) &Ptr2BufDescriptor -> Sender;
CFE_SB_UnlockSharedData(__func__,__LINE__);

System observed on:
N/A

Additional context
#605

Reporter Info
Jacob Hageman

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions