Harden fm-shim-backend URI length handling#2
Conversation
|
Summary Added an explicit overflow guard before building arg_arr (uri_list_len + 4) to prevent wraparound in allocation sizing for execve() arguments. Added validation for negative uri_list_len returned from D-Bus argument decoding; invalid negative lengths are now rejected before conversion, preventing huge size_t values and potential oversized allocations/out-of-bounds behavior. Updated both call paths to pass the validated size_t length into launch_frontend_process() consistently (no-reply and normal reply flow). |
|
Integrated the useful changes from this in ArrayBolt3@c96fb11. |
Motivation
Description
launch_frontend_processsignature to acceptsize_t uri_list_lenso allocation/index math is size-safe.if (uri_list_len > SIZE_MAX - 4)before allocating the argument array forexecve().int uri_list_lenreturned bydbus_message_get_argsto detect and reject negative lengths before converting tosize_t.size_tlength into both the no-reply and normal reply code paths when callinglaunch_frontend_process.Testing
gcc -fsyntax-onlyandgcc -x c -fsyntax-onlyto validate the changes; these checks failed to complete a full build because the container lacksdbus-1/libsystemddevelopment headers andpkg-configmetadata, so a full compile/link test could not be performed.Codex Task