... | ... |
@@ -3100,7 +3100,6 @@ static void cli_bytetype_helper(const struct cli_bc *bc, unsigned tid) |
3100 | 3100 |
unsigned i, j; |
3101 | 3101 |
const struct cli_bc_type *ty; |
3102 | 3102 |
|
3103 |
- |
|
3104 | 3103 |
if (tid & 0x8000) { |
3105 | 3104 |
printf("alloc "); |
3106 | 3105 |
tid &= 0x7fff; |
... | ... |
@@ -3112,7 +3111,10 @@ static void cli_bytetype_helper(const struct cli_bc *bc, unsigned tid) |
3112 | 3112 |
} |
3113 | 3113 |
|
3114 | 3114 |
i = tid - 65; |
3115 |
- |
|
3115 |
+ if (i >= bc->num_types) { |
|
3116 |
+ printf("invaltype"); |
|
3117 |
+ return; |
|
3118 |
+ } |
|
3116 | 3119 |
ty = &bc->types[i]; |
3117 | 3120 |
|
3118 | 3121 |
switch (ty->kind) { |
... | ... |
@@ -3229,7 +3231,7 @@ void cli_byteinst_describe(const struct cli_bc_inst *inst, unsigned *bbnum) |
3229 | 3229 |
return; |
3230 | 3230 |
} |
3231 | 3231 |
|
3232 |
- snprintf(inst_str, 256, "%-20s[%-3d/%3d/%3d]", bc_opstr[inst->opcode], |
|
3232 |
+ snprintf(inst_str, sizeof(inst_str), "%-20s[%-3d/%3d/%3d]", bc_opstr[inst->opcode], |
|
3233 | 3233 |
inst->opcode, inst->interp_op, inst->interp_op%inst->opcode); |
3234 | 3234 |
printf("%-35s", inst_str); |
3235 | 3235 |
switch (inst->opcode) { |