selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Nicolas Iooss <nicolas.iooss@m4x.org>, selinux@vger.kernel.org
Subject: Re: [PATCH v2 2/2] libselinux: do not add rc to pos twice
Date: Fri, 20 Sep 2019 10:22:40 -0400	[thread overview]
Message-ID: <16024ca5-6af2-0812-a16d-71d13396f18e@tycho.nsa.gov> (raw)
In-Reply-To: <20190920055955.2780-2-nicolas.iooss@m4x.org>

On 9/20/19 1:59 AM, Nicolas Iooss wrote:
> In regex_format_error(), when error_data->error_offset is zero, rc is
> not updated and should not be added to pos again.
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>

> ---
>   libselinux/src/regex.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libselinux/src/regex.c b/libselinux/src/regex.c
> index c835dd1b0e5d..770bc3ea1310 100644
> --- a/libselinux/src/regex.c
> +++ b/libselinux/src/regex.c
> @@ -552,10 +552,10 @@ void regex_format_error(struct regex_error_data const *error_data, char *buffer,
>   #endif
>   		if (rc < 0)
>   			abort();
> +		pos += rc;
> +		if (pos >= buf_size)
> +			goto truncated;
>   	}
> -	pos += rc;
> -	if (pos >= buf_size)
> -		goto truncated;
>   
>   #ifdef USE_PCRE2
>   	rc = pcre2_get_error_message(error_data->error_code,
> 


  reply	other threads:[~2019-09-20 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  5:59 [PATCH v2 1/2] libselinux: ensure strlen() is not called on NULL Nicolas Iooss
2019-09-20  5:59 ` [PATCH v2 2/2] libselinux: do not add rc to pos twice Nicolas Iooss
2019-09-20 14:22   ` Stephen Smalley [this message]
2019-09-23 13:54   ` Stephen Smalley
2019-09-20 14:22 ` [PATCH v2 1/2] libselinux: ensure strlen() is not called on NULL Stephen Smalley

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=16024ca5-6af2-0812-a16d-71d13396f18e@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=nicolas.iooss@m4x.org \
    --cc=selinux@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).