Replicate the max_start_pad value from the transform interface into
the instance interface.
Use the instance's version in site.c.
While we're at it, add an assertion to confirm that the value of
max_start_pad passed to buffer_init doesn't overrun the buffer.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
transform_apply_fn *forwards;
transform_apply_fn *reverse;
transform_destroyinstance_fn *destroy;
transform_apply_fn *forwards;
transform_apply_fn *reverse;
transform_destroyinstance_fn *destroy;
+ int32_t max_start_pad; /* same as from transform_if */
BUF_ALLOC(&st->buffer,"site:MSG5");
/* We are going to add four words to the message */
BUF_ALLOC(&st->buffer,"site:MSG5");
/* We are going to add four words to the message */
- buffer_init(&st->buffer,st->transform->max_start_pad+(4*4));
+ buffer_init(&st->buffer,st->new_transform->max_start_pad+(4*4));
/* Give the netlink code an opportunity to put its own stuff in the
message (configuration information, etc.) */
buf_prepend_uint32(&st->buffer,LABEL_MSG5);
/* Give the netlink code an opportunity to put its own stuff in the
message (configuration information, etc.) */
buf_prepend_uint32(&st->buffer,LABEL_MSG5);
BUF_ALLOC(&st->buffer,"site:MSG6");
/* We are going to add four words to the message */
BUF_ALLOC(&st->buffer,"site:MSG6");
/* We are going to add four words to the message */
- buffer_init(&st->buffer,st->transform->max_start_pad+(4*4));
+ buffer_init(&st->buffer,transform->max_start_pad+(4*4));
/* Give the netlink code an opportunity to put its own stuff in the
message (configuration information, etc.) */
buf_prepend_uint32(&st->buffer,LABEL_MSG6);
/* Give the netlink code an opportunity to put its own stuff in the
message (configuration information, etc.) */
buf_prepend_uint32(&st->buffer,LABEL_MSG6);
if (current_valid(st) && st->buffer.free
&& transport_peers_valid(&st->peers)) {
BUF_ALLOC(&st->buffer,"site:MSG7");
if (current_valid(st) && st->buffer.free
&& transport_peers_valid(&st->peers)) {
BUF_ALLOC(&st->buffer,"site:MSG7");
- buffer_init(&st->buffer,st->transform->max_start_pad+(4*3));
+ buffer_init(&st->buffer,st->current.transform->max_start_pad+(4*3));
buf_append_uint32(&st->buffer,LABEL_MSG7);
buf_append_string(&st->buffer,reason);
if (call_transform_forwards(st, st->current.transform,
buf_append_uint32(&st->buffer,LABEL_MSG7);
buf_append_string(&st->buffer,reason);
if (call_transform_forwards(st, st->current.transform,
ti->ops.forwards=transform_forward; \
ti->ops.reverse=transform_reverse; \
ti->ops.destroy=transform_destroy; \
ti->ops.forwards=transform_forward; \
ti->ops.reverse=transform_reverse; \
ti->ops.destroy=transform_destroy; \
+ ti->ops.max_start_pad=st->ops.max_start_pad; \
ti->keyed=False;
#endif /*TRANSFORM_COMMON_H*/
ti->keyed=False;
#endif /*TRANSFORM_COMMON_H*/
void buffer_init(struct buffer_if *buffer, int32_t max_start_pad)
{
void buffer_init(struct buffer_if *buffer, int32_t max_start_pad)
{
+ assert(max_start_pad<=buffer->len);
buffer->start=buffer->base+max_start_pad;
buffer->size=0;
}
buffer->start=buffer->base+max_start_pad;
buffer->size=0;
}