mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
jack: check arguments
Guard against some evil jack clients
This commit is contained in:
parent
9bec2e5d8a
commit
9e44b957f0
4 changed files with 301 additions and 60 deletions
|
|
@ -72,18 +72,23 @@ int jack_uuid_compare (jack_uuid_t id1, jack_uuid_t id2)
|
|||
SPA_EXPORT
|
||||
void jack_uuid_copy (jack_uuid_t* dst, jack_uuid_t src)
|
||||
{
|
||||
spa_return_if_fail(dst != NULL);
|
||||
*dst = src;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
void jack_uuid_clear (jack_uuid_t *id)
|
||||
{
|
||||
spa_return_if_fail(id != NULL);
|
||||
*id = 0;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
int jack_uuid_parse (const char *buf, jack_uuid_t *id)
|
||||
{
|
||||
spa_return_val_if_fail(buf != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(id != NULL, -EINVAL);
|
||||
|
||||
if (sscanf (buf, "%" PRIu64, id) == 1) {
|
||||
if (*id < (0x1LL << 32)) {
|
||||
/* has not type bits set - not legal */
|
||||
|
|
@ -97,6 +102,7 @@ int jack_uuid_parse (const char *buf, jack_uuid_t *id)
|
|||
SPA_EXPORT
|
||||
void jack_uuid_unparse (jack_uuid_t id, char buf[JACK_UUID_STRING_SIZE])
|
||||
{
|
||||
spa_return_if_fail(buf != NULL);
|
||||
snprintf (buf, JACK_UUID_STRING_SIZE, "%" PRIu64, id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue