mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
proplist: allow setting of zero-length data properties
This commit is contained in:
parent
5df842db64
commit
35fcb27a81
1 changed files with 3 additions and 2 deletions
|
|
@ -251,7 +251,7 @@ int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nb
|
|||
|
||||
pa_assert(p);
|
||||
pa_assert(key);
|
||||
pa_assert(data);
|
||||
pa_assert(data || nbytes == 0);
|
||||
|
||||
if (!property_name_valid(key))
|
||||
return -1;
|
||||
|
|
@ -264,7 +264,8 @@ int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nb
|
|||
pa_xfree(prop->value);
|
||||
|
||||
prop->value = pa_xmalloc(nbytes+1);
|
||||
memcpy(prop->value, data, nbytes);
|
||||
if (nbytes > 0)
|
||||
memcpy(prop->value, data, nbytes);
|
||||
((char*) prop->value)[nbytes] = 0;
|
||||
prop->nbytes = nbytes;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue