modules: fix missing free/close and length checks

Fix some missing free and close.

Fix not checking length of received netjack data.
This commit is contained in:
Pauli Virtanen 2025-06-14 15:24:05 +03:00
parent baadda3b67
commit dc618d37c6
3 changed files with 13 additions and 8 deletions

View file

@ -1478,6 +1478,8 @@ static int parse_sdp(struct impl *impl, char *sdp, struct sdp_info *info)
int count = 0, res = 0;
size_t l;
spa_zero(*info);
while (*s) {
if ((l = strcspn(s, "\r\n")) < 2)
goto too_short;
@ -1523,12 +1525,15 @@ static int parse_sdp(struct impl *impl, char *sdp, struct sdp_info *info)
return 0;
too_short:
pw_log_warn("SDP: line starting with `%.6s...' too short", s);
clear_sdp_info(info);
return -EINVAL;
invalid_version:
pw_log_warn("SDP: invalid first version line `%*s'", (int)l, s);
clear_sdp_info(info);
return -EINVAL;
error:
pw_log_warn("SDP: error: %s", spa_strerror(res));
clear_sdp_info(info);
return res;
}
@ -1570,7 +1575,6 @@ static int parse_sap(struct impl *impl, void *data, size_t len)
pw_log_debug("got SAP: %s %s", mime, sdp);
spa_zero(info);
if ((res = parse_sdp(impl, sdp, &info)) < 0)
return res;