[vlc-commits] audiobargraph: boundary check
Rémi Denis-Courmont
git at videolan.org
Tue Nov 18 22:28:22 CET 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 18 23:27:54 2014 +0200| [327a8846b43c7e2426efc8e9af04fc5601540812] | committer: Rémi Denis-Courmont
audiobargraph: boundary check
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=327a8846b43c7e2426efc8e9af04fc5601540812
---
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