summaryrefslogtreecommitdiff
path: root/sys/shm
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2015-04-20 14:20:05 +0200
committerEdward Hervey <bilboed@bilboed.com>2015-04-20 14:21:09 +0200
commitaf49c109e456dcba341b7536549833ab95d80468 (patch)
treebc5e796d9905630254c102f8d3a8fc28b361d9f5 /sys/shm
parentfa4822a41ba6c4d9d988b1426dabe207dc4c9fea (diff)
downloadgstreamer-plugins-bad-af49c109e456dcba341b7536549833ab95d80468.tar.gz
shmpipe: Ensure string received from recv() is NULL-terminated
We will be doing string operations on it later. CID #1292830
Diffstat (limited to 'sys/shm')
-rw-r--r--sys/shm/shmpipe.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c
index 0d7bf26c3..de89026ff 100644
--- a/sys/shm/shmpipe.c
+++ b/sys/shm/shmpipe.c
@@ -669,13 +669,15 @@ sp_client_recv (ShmPipe * self, char **buf)
assert (cb.payload.new_shm_area.path_size > 0);
assert (cb.payload.new_shm_area.size > 0);
- area_name = malloc (cb.payload.new_shm_area.path_size);
+ area_name = malloc (cb.payload.new_shm_area.path_size + 1);
retval = recv (self->main_socket, area_name,
cb.payload.new_shm_area.path_size, 0);
if (retval != cb.payload.new_shm_area.path_size) {
free (area_name);
return -3;
}
+ /* Ensure area_name is NULL terminated */
+ area_name[retval] = 0;
newarea = sp_open_shm (area_name, cb.area_id, 0,
cb.payload.new_shm_area.size);