Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Buffer overflow in unit tests when using default config #66

@jphickey

Description

@jphickey

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
The unit test code sets the EventText member with a call to strncpy and a hardcoded size here:

strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", 50);

However in the default platform config the size is only 32:

#define LC_MAX_ACTION_TEXT 32

To Reproduce
Build and run using default/out-of-box config.

Expected behavior
Example configuration should not trigger buffer overflow

Additional context
Consider using sizeof() operator here, to adapt the strncpy call to the real size of the target buffer.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions