X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fsflow_receiver.c;h=e6fc9a7f9bfe49048532595f5063dfeed5aa7ed5;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=019f38f7e22d5051a1697b4dc1685ec33e00725e;hpb=6506f45c0818618e96deb858bbabdf2cc90eb2df;p=sliver-openvswitch.git diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c index 019f38f7e..e6fc9a7f9 100644 --- a/lib/sflow_receiver.c +++ b/lib/sflow_receiver.c @@ -1,5 +1,9 @@ -/* 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. */ @@ -194,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) {