aboutsummaryrefslogtreecommitdiff
path: root/osc
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2010-05-13 19:35:26 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2010-05-13 19:35:26 +0000
commitfc20d3442a848e0b4c414a296ea4f8fbad4aec10 (patch)
tree72fde67c693d8e5bf22132ec4cdcaa4557e4b18d /osc
parent1d88e789da501f734e9ee1f347ff00ce8c79efd7 (diff)
Check for buffer overflow in case of bad input.
svn path=/trunk/externals/mrpeach/; revision=13533
Diffstat (limited to 'osc')
-rw-r--r--osc/unpackOSC.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/osc/unpackOSC.c b/osc/unpackOSC.c
index a045002..56054b6 100644
--- a/osc/unpackOSC.c
+++ b/osc/unpackOSC.c
@@ -177,6 +177,11 @@ static void unpackOSC_list(t_unpackOSC *x, t_symbol *s, int argc, t_atom *argv)
post("unpackOSC: packet size (%d) not a multiple of 4 bytes: dropping packet", argc);
return;
}
+ if(argc > MAX_MESG)
+ {
+ post("unpackOSC: packet size (%d) greater than max (%d). Change MAX_MESG and recompile if you want more.", argc, MAX_MESG);
+ return;
+ }
/* copy the list to a byte buffer, checking for bytes only */
for (i = 0; i < argc; ++i)
{
@@ -208,7 +213,7 @@ static void unpackOSC_list(t_unpackOSC *x, t_symbol *s, int argc, t_atom *argv)
if ((argc >= 8) && (strncmp(buf, "#bundle", 8) == 0))
{ /* This is a bundle message. */
#ifdef DEBUG
- post("unpackOSC: bundle msg: bundles not yet supported\n");
+ post("unpackOSC: bundle msg:\n");
#endif
if (argc < 16)