Bugfix: check should cover min(hdrsize, datalen), not max
This commit is contained in:
parent
c0c26262c4
commit
4d35b905d3
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: ipolite.c,v 1.9 2008/06/26 11:38:59 nifi Exp $
|
||||
* $Id: ipolite.c,v 1.10 2008/07/07 23:27:05 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -50,9 +50,13 @@
|
|||
#include <string.h>
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#define MAX(a, b) ((a) > (b)? (a) : (b))
|
||||
#endif /* MAX */
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) > (b)? (a) : (b))
|
||||
#endif /* MIN */
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
|
@ -69,7 +73,7 @@ recv(struct broadcast_conn *broadcast, rimeaddr_t *from)
|
|||
if(c->q != NULL &&
|
||||
rimebuf_datalen() == queuebuf_datalen(c->q) &&
|
||||
memcmp(rimebuf_dataptr(), queuebuf_dataptr(c->q),
|
||||
MAX(c->hdrsize, rimebuf_datalen())) == 0) {
|
||||
MIN(c->hdrsize, rimebuf_datalen())) == 0) {
|
||||
/* We received a copy of our own packet, so we do not send out
|
||||
packet. */
|
||||
queuebuf_free(c->q);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: polite.c,v 1.4 2008/02/24 22:05:27 adamdunkels Exp $
|
||||
* $Id: polite.c,v 1.5 2008/07/07 23:27:05 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,11 @@
|
|||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#endif /* MAX */
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) > (b)? (a) : (b))
|
||||
#endif /* MIN */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
recv(struct abc_conn *abc)
|
||||
|
@ -61,7 +66,7 @@ recv(struct abc_conn *abc)
|
|||
if(c->q != NULL &&
|
||||
rimebuf_datalen() == queuebuf_datalen(c->q) &&
|
||||
memcmp(rimebuf_dataptr(), queuebuf_dataptr(c->q),
|
||||
MAX(c->hdrsize, rimebuf_datalen())) == 0) {
|
||||
MIN(c->hdrsize, rimebuf_datalen())) == 0) {
|
||||
/* We received a copy of our own packet, so we do not send out
|
||||
packet. */
|
||||
queuebuf_free(c->q);
|
||||
|
|
Loading…
Reference in a new issue