Commit 1142c182 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Jean-Baptiste Kempf

audiobargraph: boundary check

(cherry picked from commit 327a8846b43c7e2426efc8e9af04fc5601540812)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 92fd9b9e
...@@ -147,20 +147,17 @@ static int Open( vlc_object_t *p_this ) ...@@ -147,20 +147,17 @@ static int Open( vlc_object_t *p_this )
static void SendValues(filter_t *p_filter, float *value, int nbChannels) static void SendValues(filter_t *p_filter, float *value, int nbChannels)
{ {
char message[256]; char msg[256];
size_t len = 0; size_t len = 0;
for (int i = 0; i < nbChannels; i++) { for (int i = 0; i < nbChannels; i++) {
if (len >= sizeof(message)) if (len >= sizeof (msg))
break; break;
len += snprintf(message + len, sizeof (message),"%f:", value[i]); len += snprintf(msg + len, sizeof (msg) - len, "%f:", value[i]);
} }
message[len-1] = '\0';
//msg_Dbg(p_filter, "values: %s", message); //msg_Dbg(p_filter, "values: %s", message);
var_SetString(p_filter->p_libvlc, "audiobargraph_v-i_values", msg);
var_SetString(p_filter->p_libvlc, "audiobargraph_v-i_values",
message);
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment