diff options
Diffstat (limited to 'src/vnet/pg')
-rw-r--r-- | src/vnet/pg/edit.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/pg/edit.c b/src/vnet/pg/edit.c index a0aab1fb566..7d4e1713c4c 100644 --- a/src/vnet/pg/edit.c +++ b/src/vnet/pg/edit.c @@ -167,13 +167,13 @@ unformat_pg_payload (unformat_input_t * input, va_list * args) for (i = 0; i < len; i++) v[i] = i % ilen; - e = pg_create_edit_group (s, sizeof (e[0]), 0, 0); + e = pg_create_edit_group (s, sizeof (e[0]), len, 0); e->type = PG_EDIT_FIXED; - e->n_bits = vec_len (v) * BITS (v[0]); + e->n_bits = len * BITS (v[0]); /* Least significant bit is at end of bitstream, since everything is always bigendian. */ - e->lsb_bit_offset = e->n_bits - BITS (v[0]); + e->lsb_bit_offset = len > 0 ? e->n_bits - BITS (v[0]) : 0; e->values[PG_EDIT_LO] = v; |