nasa / LC

The Core Flight System (cFS) Limit Checker (LC) application.
Apache License 2.0
30 stars 21 forks source link

Buffer overflow in unit tests when using default config #66

Closed jphickey closed 1 year ago

jphickey commented 1 year ago

Checklist (Please check before submitting)

Describe the bug The unit test code sets the EventText member with a call to strncpy and a hardcoded size here: https://github.com/nasa/LC/blob/779b903faef553299d8130aded0b9f5133ffa8c5/unit-test/lc_action_tests.c#L233

However in the default platform config the size is only 32: https://github.com/nasa/LC/blob/779b903faef553299d8130aded0b9f5133ffa8c5/fsw/inc/lc_platform_cfg.h#L228

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.