SELinux Archive mirror
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: "Christian Göttsche" <cgzones@googlemail.com>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH 1/3] libsepol: constify tokenized input
Date: Tue, 12 Dec 2023 11:43:49 -0500	[thread overview]
Message-ID: <CAP+JOzT-bmDzZ5HvHw3+POXFZmovC4cheah37S5fB++BHi0uVA@mail.gmail.com> (raw)
In-Reply-To: <CAP+JOzRcTCL2yqk6PTJrvvc+116+o763voETrrcqDkNvO2KQ7A@mail.gmail.com>

On Mon, Dec 11, 2023 at 10:49 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Mon, Dec 11, 2023 at 9:48 AM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > The input string to be tokenized is not modified.
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For these three patches:
> Acked-by: James Carter <jwcart2@gmail.com>
>

These three patches have been merged.
Thanks,
Jim

> > ---
> >  libsepol/include/sepol/policydb/util.h | 2 +-
> >  libsepol/src/util.c                    | 9 +++++----
> >  2 files changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/libsepol/include/sepol/policydb/util.h b/libsepol/include/sepol/policydb/util.h
> > index db8da213..4ea5a346 100644
> > --- a/libsepol/include/sepol/policydb/util.h
> > +++ b/libsepol/include/sepol/policydb/util.h
> > @@ -40,7 +40,7 @@ char *sepol_extended_perms_to_string(avtab_extended_perms_t *xperms);
> >   * The tokenize function may be used to
> >   * replace sscanf
> >   */
> > -extern int tokenize(char *line_buf, char delim, int num_args, ...);
> > +extern int tokenize(const char *line_buf, char delim, int num_args, ...);
> >
> >  #ifdef __cplusplus
> >  }
> > diff --git a/libsepol/src/util.c b/libsepol/src/util.c
> > index 2f877920..571f6c93 100644
> > --- a/libsepol/src/util.c
> > +++ b/libsepol/src/util.c
> > @@ -221,9 +221,9 @@ err:
> >   */
> >
> >  /* Read a token from a buffer */
> > -static inline int tokenize_str(char delim, char **str, char **ptr, size_t *len)
> > +static inline int tokenize_str(char delim, char **str, const char **ptr, size_t *len)
> >  {
> > -       char *tmp_buf = *ptr;
> > +       const char *tmp_buf = *ptr;
> >         *str = NULL;
> >
> >         while (**ptr != '\0') {
> > @@ -273,9 +273,10 @@ static inline int tokenize_str(char delim, char **str, char **ptr, size_t *len)
> >   * contain the remaining content of line_buf. If the delimiter is any whitespace
> >   * character, then all whitespace will be squashed.
> >   */
> > -int tokenize(char *line_buf, char delim, int num_args, ...)
> > +int tokenize(const char *line_buf, char delim, int num_args, ...)
> >  {
> > -       char **arg, *buf_p;
> > +       char **arg;
> > +       const char *buf_p;
> >         int rc, items;
> >         size_t arg_len = 0;
> >         va_list ap;
> > --
> > 2.43.0
> >
> >

      reply	other threads:[~2023-12-12 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 14:48 [PATCH 1/3] libsepol: constify tokenized input Christian Göttsche
2023-12-11 14:48 ` [PATCH 2/3] libsepol: avoid integer overflow in add_i_to_a() Christian Göttsche
2023-12-11 14:48 ` [PATCH 3/3] libsepol: extended permission formatting cleanup Christian Göttsche
2023-12-11 15:49 ` [PATCH 1/3] libsepol: constify tokenized input James Carter
2023-12-12 16:43   ` James Carter [this message]

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=CAP+JOzT-bmDzZ5HvHw3+POXFZmovC4cheah37S5fB++BHi0uVA@mail.gmail.com \
    --to=jwcart2@gmail.com \
    --cc=cgzones@googlemail.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).