diff --git a/common/utils/T/tracer/forward.c b/common/utils/T/tracer/forward.c index 90ca43374ea5244a7b570664ecbfae850dae4f70..27b36c9a9b7f5fcda4028b1540156a4f88262b4e 100644 --- a/common/utils/T/tracer/forward.c +++ b/common/utils/T/tracer/forward.c @@ -150,15 +150,18 @@ again: void forward(void *_forwarder, char *buf, int size) { forward_data *f = _forwarder; + int32_t ssize = size; databuf *new; new = malloc(sizeof(*new)); if (new == NULL) abort(); if (pthread_mutex_lock(&f->datalock)) abort(); - new->d = malloc(size); if (new->d == NULL) abort(); - memcpy(new->d, buf, size); - new->l = size; + new->d = malloc(size + 4); if (new->d == NULL) abort(); + /* put the size of the message at the head */ + memcpy(new->d, &ssize, 4); + memcpy(new->d+4, buf, size); + new->l = size+4; new->next = NULL; if (f->head == NULL) f->head = new; if (f->tail != NULL) f->tail->next = new; diff --git a/common/utils/T/tracer/remote.c b/common/utils/T/tracer/remote.c index 0656daa68da969e3add9233f4a9b178f607ee0a0..225db809b7c66849f8540dfd9ed7031769199262 100644 --- a/common/utils/T/tracer/remote.c +++ b/common/utils/T/tracer/remote.c @@ -91,7 +91,9 @@ void get_message(int s) printf("["x"]["y"] %s", str); \ } while (0) + int32_t size; int m; + if (GET(s, &size, 4) != 4) abort(); if (GET(s, &m, sizeof(int)) != sizeof(int)) abort(); switch (m) { case T_first: {