mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
To: Roberto Sassu <roberto.sassu@polito.it>
Cc: jmorris@namei.org, zohar@linux.vnet.ibm.com,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ima: store address of template_fmt_copy in a pointer before calling strsep
Date: Wed, 27 Nov 2013 16:01:09 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.10.1311271600400.3966@c4eb> (raw)
In-Reply-To: <1385559644-9217-1-git-send-email-roberto.sassu@polito.it>



On Wed, 27 Nov 2013, Roberto Sassu wrote:
> This patch stores the address of the 'template_fmt_copy' variable in a new
> variable, called 'template_fmt_ptr', so that the latter is passed as an
> argument of strsep() instead of the former. This modification is needed
> in order to correctly free the memory area referenced by
> 'template_fmt_copy' (strsep() modifies the pointer of the passed string).
> 

This one helped. Thanks!

Sebastian

> Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
> ---
>  security/integrity/ima/ima_template.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
> index 913e192..635695f 100644
> --- a/security/integrity/ima/ima_template.c
> +++ b/security/integrity/ima/ima_template.c
> @@ -110,7 +110,7 @@ static int template_desc_init_fields(const char *template_fmt,
>  				     struct ima_template_field ***fields,
>  				     int *num_fields)
>  {
> -	char *c, *template_fmt_copy;
> +	char *c, *template_fmt_copy, *template_fmt_ptr;
>  	int template_num_fields = template_fmt_size(template_fmt);
>  	int i, result = 0;
> 
> @@ -127,7 +127,9 @@ static int template_desc_init_fields(const char *template_fmt,
>  		result = -ENOMEM;
>  		goto out;
>  	}
> -	for (i = 0; (c = strsep(&template_fmt_copy, "|")) != NULL &&
> +
> +	template_fmt_ptr = template_fmt_copy;
> +	for (i = 0; (c = strsep(&template_fmt_ptr, "|")) != NULL &&
>  	     i < template_num_fields; i++) {
>  		struct ima_template_field *f = lookup_template_field(c);
> 
> -- 
> 1.8.1.4
> 
> 


  parent reply	other threads:[~2013-11-27 15:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 18:40 [GIT PULL] ima: bug fixes for Linus Mimi Zohar
2013-11-24 15:21 ` Mimi Zohar
2013-11-24 22:44   ` James Morris
2013-11-25  0:14     ` Mimi Zohar
2013-11-25  2:14       ` James Morris
2013-11-25 12:03         ` Mimi Zohar
2013-11-25 13:51           ` Mimi Zohar
2013-11-25 15:40             ` James Morris
2013-11-25 18:46               ` Roberto Sassu
2013-11-25 18:55                 ` Roberto Sassu
2013-11-27 12:11                   ` Sebastian Ott
2013-11-27 12:46                     ` Roberto Sassu
2013-11-27 13:40                       ` [PATCH] ima: store address of template_fmt_copy in a pointer before calling strsep Roberto Sassu
2013-11-27 14:55                         ` Mimi Zohar
2013-11-27 15:01                         ` Sebastian Ott [this message]
2013-11-25 20:33                 ` [GIT PULL v3] ima: bug fixes for Linus Mimi Zohar
2013-11-25 20:54                   ` Shuah Khan
2013-11-25 21:32                     ` Mimi Zohar
2013-11-25 19:18               ` [PATCH] ima: make a copy of template_fmt in template_desc_init_fields() Roberto Sassu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.10.1311271600400.3966@c4eb \
    --to=sebott@linux.vnet.ibm.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=roberto.sassu@polito.it \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome