[vlc-commits] audiobargraph: boundary check
Rémi Denis-Courmont
git at videolan.org
Thu Nov 20 19:45:18 CET 2014
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 18 23:27:54 2014 +0200| [1142c18287b4af7928b478ccb70bde6d2111ce2e] | committer: Jean-Baptiste Kempf
audiobargraph: boundary check
(cherry picked from commit 327a8846b43c7e2426efc8e9af04fc5601540812)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=1142c18287b4af7928b478ccb70bde6d2111ce2e
---
modules/audio_filter/audiobargraph_a.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/modules/audio_filter/audiobargraph_a.c b/modules/audio_filter/audiobargraph_a.c
index 81275d6..8fd9607 100644
--- a/modules/audio_filter/audiobargraph_a.c
+++ b/modules/audio_filter/audiobargraph_a.c
@@ -147,20 +147,17 @@ static int Open( vlc_object_t *p_this )
static void SendValues(filter_t *p_filter, float *value, int nbChannels)
{
- char message[256];
+ char msg[256];
size_t len = 0;
for (int i = 0; i < nbChannels; i++) {
- if (len >= sizeof(message))
+ if (len >= sizeof (msg))
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);
-
- var_SetString(p_filter->p_libvlc, "audiobargraph_v-i_values",
- message);
+ var_SetString(p_filter->p_libvlc, "audiobargraph_v-i_values", msg);
}
/*****************************************************************************
More information about the vlc-commits
mailing list