diff options
| author | Lennart Poettering <lennart@poettering.net> | 2009-08-27 05:33:45 +0200 | 
|---|---|---|
| committer | Colin Guthrie <cguthrie@mandriva.org> | 2009-09-01 23:55:21 +0100 | 
| commit | b10bddf99bdda3a776d5f92bcb7c07a2b16b91e0 (patch) | |
| tree | 03ff7823c954c2975f774dc0efc2b0f02545404a | |
| parent | 35ccb319e6a1e8e7ada88d85ede16612c140fefe (diff) | |
proplist: allow setting of zero-length data properties
| -rw-r--r-- | src/pulse/proplist.c | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c index db4c9344..274f7087 100644 --- a/src/pulse/proplist.c +++ b/src/pulse/proplist.c @@ -236,7 +236,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; @@ -249,7 +249,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;  | 
