Re: [PATCH 3/5] evaluate: check variadic argument types against formatting info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 25, 2019 at 11:00:13AM +0100, Ben Dooks wrote:
> +static struct format_type *parse_printf_get_fmt(struct format_type *type, const char *msg, const char **msgout)
> +{

...

> +	} else if (*ptr == 'p') {
> +		ptr++;
> +		type->test = printf_fmt_print_pointer;
> +		//todo - check if there's anything after these?
> +		if (*ptr == 'x' || *ptr == 'X') {
> +			ptr++;
> +		} else if (isalpha(*ptr)) {
> +			// probably sxomething that /is/ being de-referenced
> +			ptr++;
> +			type->test = printf_fmt_pointer;
> +		}

This needs an explanation for the isalpha() and why x/X is special cased.

> +	} else if (*ptr == 'z') {
> +		ptr++;
> +		if (*ptr == 'd') {
> +			ptr++;
> +			type->test = printf_fmt_numtype;
> +			type->data = &long_ctype;
> +		} else if (*ptr == 'u' || *ptr == 'x') {
> +			ptr++;
> +			type->test = printf_fmt_numtype;
> +			type->data = &ulong_ctype;

These should use size_t_ctype & ssize_t_type.
They also work with 'i', 'o' & 'X'.

> +		} else if (is_float_spec(*ptr)) {
> +			type->test = printf_fmt_numtype;
> +			type->data = &double_ctype;

if (szmod == 1) type->data = &ldouble_ctype;

-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux