wavparse: use g_strndup() for copying text data

So we don't rely on NUL terminators inside the data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/994>
This commit is contained in:
Tim-Philipp Müller 2021-05-23 15:14:11 +01:00
parent 5353ff355f
commit 80966ed0a3

View file

@ -837,7 +837,7 @@ gst_wavparse_labl_chunk (GstWavParse * wav, const guint8 * data, guint32 size)
/* parse data */
labl->cue_point_id = GST_READ_UINT32_LE (data);
labl->text = g_memdup (data + 4, size - 4);
labl->text = g_strndup ((const gchar *) data + 4, size - 4);
wav->labls = g_list_append (wav->labls, labl);
@ -866,7 +866,7 @@ gst_wavparse_note_chunk (GstWavParse * wav, const guint8 * data, guint32 size)
/* parse data */
note->cue_point_id = GST_READ_UINT32_LE (data);
note->text = g_memdup (data + 4, size - 4);
note->text = g_strndup ((const gchar *) data + 4, size - 4);
wav->notes = g_list_append (wav->notes, note);