mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-26 03:38:47 +00:00
Without an explicit path, `msrp_recv_file_function()` joined the `sip_msrp_file_name` channel variable, taken from the remote SDP `a=file-selector` name, onto the base directory unchanged, so a name with directory components opened a file outside it. Reduce the name to its last path component with `switch_cut_path()` and reject an empty name, `.` and `..`. `test_switch_cut_path_strips_directory_components` covers the path reduction the receive path relies on.
FreeSWITCH unit tests should be kept as shallow unit tests and micro benchmarks testing functionality exposed through libfreeswitch. Requirements for a new unit tests: 1. Tests must use switch_test.h framework