module-portal: use spa_atoi32 for safer PID parsing

This commit is contained in:
Peter Hutterer 2021-07-30 15:59:37 +10:00 committed by Wim Taymans
parent 82e427745d
commit b6a8f67764

View file

@ -114,8 +114,7 @@ context_check_access(void *data, struct pw_impl_client *client)
if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) == NULL) if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) == NULL)
return; return;
pid = atoi(str); if (!spa_atoi32(str, &pid, 10) || pid != impl->portal_pid)
if (pid != impl->portal_pid)
return; return;
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "portal"); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "portal");