ublox: fix UAF in custom init ready URC handler

Clear the unsolicited message handler in ready_received() before
completing the task. Otherwise, if the modem sends subsequent READY
URCs, the handler would fire again using the freed GTask pointer.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1074

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
This commit is contained in:
Aleksander Morgado
2026-07-10 15:00:07 +02:00
committed by Aleksander Morgado
parent db72a182c1
commit 9642ed9ab5
+3
View File
@@ -113,6 +113,9 @@ ready_received (MMPortSerialAt *port,
g_source_remove (ctx->timeout_id); g_source_remove (ctx->timeout_id);
ctx->timeout_id = 0; ctx->timeout_id = 0;
mm_port_serial_at_add_unsolicited_msg_handler (port, ctx->ready_regex,
NULL, NULL, NULL);
mm_obj_dbg (probe, "received READY: port is AT"); mm_obj_dbg (probe, "received READY: port is AT");
/* Flag as an AT port right away */ /* Flag as an AT port right away */