lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 26 Mar 2012 15:15:24 -0300
From:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To:	Jörg Sommer <joerg@...a.gnuu.de>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] perf tools: Concatenate strings in expressions

Em Sun, Mar 25, 2012 at 11:08:39PM +0200, Jörg Sommer escreveu:
> The tracepoint event kvm_userspace_exit uses string snippet the C
> compiler concatenates to a big string, e.g. "KVM_EXIT_" "UNKNOWN". The
> parser of the data must do the same and join successive strings.
> 
> print fmt: "reason %s (%d)", … __print_symbolic(REC->reason, { 0, "KVM_EXIT_" "UNKNOWN" }, { 1, "KVM_EXIT_" "EXCEPTION" } …
> 
> Signed-off-by: Jörg Sommer <joerg@...a.gnuu.de>
> ---
>  tools/perf/util/trace-event-parse.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
> index 1a8d4dc..185e284 100644
> --- a/tools/perf/util/trace-event-parse.c
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -1726,6 +1726,21 @@ process_arg_token(struct event *event, struct print_arg *arg,
>  		}
>  		break;
>  	case EVENT_DQUOTE:
> +		atom = token;
> +		type = read_token_item(&token);
> +
> +		/* merge with following strings */
> +		while (type == EVENT_DQUOTE) {
> +			atom = realloc(atom, strlen(atom) + strlen(token) + 1);

realloc can fail, please check its result and take appropriate action.

- Arnaldo

> +			strcat(atom, token);
> +			free_token(token);
> +			type = read_token_item(&token);
> +		}
> +
> +		arg->type = PRINT_ATOM;
> +		arg->atom.atom = atom;
> +
> +		break;
>  	case EVENT_SQUOTE:
>  		arg->type = PRINT_ATOM;
>  		arg->atom.atom = token;
> -- 
> 1.7.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ