X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fsflow_receiver.c;h=e6fc9a7f9bfe49048532595f5063dfeed5aa7ed5;hb=0ef165ecb57943e17a8ee8270df68ffb8d032e29;hp=0e34959d6492a0608b020e6fadddbfb118cd8e6b;hpb=d295e8e97acae13552a5b220d3fbcff8201064a2;p=sliver-openvswitch.git diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c index 0e34959d6..e6fc9a7f9 100644 --- a/lib/sflow_receiver.c +++ b/lib/sflow_receiver.c @@ -1,5 +1,11 @@ -/* Copyright (c) 2002-2009 InMon Corp. Licensed under the terms of the InMon sFlow licence: */ -/* http://www.inmon.com/technology/sflowlicense.txt */ +/* Copyright (c) 2002-2009 InMon Corp. Licensed under the terms of either the + * Sun Industry Standards Source License 1.1, that is available at: + * http://host-sflow.sourceforge.net/sissl.html + * or the InMon sFlow License, that is available at: + * http://www.inmon.com/technology/sflowlicense.txt + */ + +#ifndef __CHECKER__ /* Don't run sparse on anything in this file. */ #include #include "sflow_api.h" @@ -192,6 +198,10 @@ inline static void putString(SFLReceiver *receiver, SFLString *s) putNet32(receiver, s->len); memcpy(receiver->sampleCollector.datap, s->str, s->len); receiver->sampleCollector.datap += (s->len + 3) / 4; /* pad to 4-byte boundary */ + if ((s->len % 4) != 0){ + u_int8_t padding = 4 - (s->len % 4); + memset(((u_int8_t*)receiver->sampleCollector.datap)-padding, 0, padding); + } } inline static u_int32_t stringEncodingLength(SFLString *s) { @@ -830,3 +840,5 @@ static void sflError(SFLReceiver *receiver, char *msg) sfl_agent_error(receiver->agent, "receiver", msg); resetSampleCollector(receiver); } + +#endif /* !__CHECKER__ */