mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
add utf8 validity checking to esound protocol
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@865 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
d419d87a73
commit
45bbb34999
1 changed files with 8 additions and 0 deletions
|
|
@ -341,6 +341,8 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
|
||||||
strncpy(name, data, sizeof(name));
|
strncpy(name, data, sizeof(name));
|
||||||
name[sizeof(name)-1] = 0;
|
name[sizeof(name)-1] = 0;
|
||||||
|
|
||||||
|
CHECK_VALIDITY(pa_utf8_valid(name), "Invalid UTF8 in stream name");
|
||||||
|
|
||||||
pa_client_set_name(c->client, name);
|
pa_client_set_name(c->client, name);
|
||||||
|
|
||||||
assert(!c->sink_input && !c->input_memblockq);
|
assert(!c->sink_input && !c->input_memblockq);
|
||||||
|
|
@ -423,6 +425,8 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
|
||||||
strncpy(name, data, sizeof(name));
|
strncpy(name, data, sizeof(name));
|
||||||
name[sizeof(name)-1] = 0;
|
name[sizeof(name)-1] = 0;
|
||||||
|
|
||||||
|
CHECK_VALIDITY(pa_utf8_valid(name), "Invalid UTF8 in stream name.");
|
||||||
|
|
||||||
pa_client_set_name(c->client, name);
|
pa_client_set_name(c->client, name);
|
||||||
|
|
||||||
assert(!c->output_memblockq && !c->source_output);
|
assert(!c->output_memblockq && !c->source_output);
|
||||||
|
|
@ -689,6 +693,8 @@ static int esd_proto_sample_cache(struct connection *c, PA_GCC_UNUSED esd_proto_
|
||||||
strcpy(name, SCACHE_PREFIX);
|
strcpy(name, SCACHE_PREFIX);
|
||||||
strncpy(name+sizeof(SCACHE_PREFIX)-1, data, ESD_NAME_MAX);
|
strncpy(name+sizeof(SCACHE_PREFIX)-1, data, ESD_NAME_MAX);
|
||||||
name[sizeof(name)-1] = 0;
|
name[sizeof(name)-1] = 0;
|
||||||
|
|
||||||
|
CHECK_VALIDITY(pa_utf8_valid(name), "Invalid UTF8 in sample name.");
|
||||||
|
|
||||||
assert(!c->scache.memchunk.memblock);
|
assert(!c->scache.memchunk.memblock);
|
||||||
c->scache.memchunk.memblock = pa_memblock_new(sc_length, c->protocol->core->memblock_stat);
|
c->scache.memchunk.memblock = pa_memblock_new(sc_length, c->protocol->core->memblock_stat);
|
||||||
|
|
@ -719,6 +725,8 @@ static int esd_proto_sample_get_id(struct connection *c, PA_GCC_UNUSED esd_proto
|
||||||
strncpy(name+sizeof(SCACHE_PREFIX)-1, data, ESD_NAME_MAX);
|
strncpy(name+sizeof(SCACHE_PREFIX)-1, data, ESD_NAME_MAX);
|
||||||
name[sizeof(name)-1] = 0;
|
name[sizeof(name)-1] = 0;
|
||||||
|
|
||||||
|
CHECK_VALIDITY(pa_utf8_valid(name), "Invalid UTF8 in sample name.");
|
||||||
|
|
||||||
ok = -1;
|
ok = -1;
|
||||||
if ((idx = pa_scache_get_id_by_name(c->protocol->core, name)) != PA_IDXSET_INVALID)
|
if ((idx = pa_scache_get_id_by_name(c->protocol->core, name)) != PA_IDXSET_INVALID)
|
||||||
ok = idx + 1;
|
ok = idx + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue