From fc20d3442a848e0b4c414a296ea4f8fbad4aec10 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Thu, 13 May 2010 19:35:26 +0000 Subject: Check for buffer overflow in case of bad input. svn path=/trunk/externals/mrpeach/; revision=13533 --- osc/unpackOSC.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1