{
/* find format arg */
unsigned idx = 0;
- for (; idx < spec->fmt_idx && arg != NULL; ++idx)
+ for (; idx < spec->fmt_idx; ++idx) {
+ if (arg == NULL)
+ return;
arg = arg->next;
-
- if (arg == NULL)
- return;
+ }
const expression_t *fmt_expr = arg->expression;
if (fmt_expr->kind == EXPR_UNARY_CAST_IMPLICIT) {
default:
warningf(pos, "encountered unknown conversion specifier '%%%C' at position %u", (wint_t)fmt, num_fmt);
+ if (arg == NULL) {
+ warningf(pos, "too few arguments for format string");
+ return;
+ }
goto next_arg;
}
{
/* find format arg */
unsigned idx = 0;
- for (; idx < spec->fmt_idx; ++idx)
+ for (; idx < spec->fmt_idx; ++idx) {
+ if (arg == NULL)
+ return;
arg = arg->next;
+ }
const expression_t *fmt_expr = arg->expression;
if (fmt_expr->kind == EXPR_UNARY_CAST_IMPLICIT) {
return;
}
/* find the real args */
- for (; idx < spec->arg_idx; ++idx)
+ for (; idx < spec->arg_idx && arg != NULL; ++idx)
arg = arg->next;
const source_position_t *pos = &fmt_expr->base.source_position;
default:
warningf(pos, "encountered unknown conversion specifier '%%%C' at position %u", (wint_t)fmt, num_fmt);
+ if (arg == NULL) {
+ warningf(pos, "too few arguments for format string");
+ return;
+ }
goto next_arg;
}