public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix argv overrun in getconf (bug 27761)
@ 2021-04-21 12:56 Andreas Schwab
  2021-04-21 13:08 ` Florian Weimer
  2021-04-21 14:28 ` H.J. Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Schwab @ 2021-04-21 12:56 UTC (permalink / raw)
  To: libc-alpha

Correct argument counter accounting when processing the -v option with the
argument directly attached.
---
 posix/getconf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/posix/getconf.c b/posix/getconf.c
index efc9623b3b..4dccc9cbf2 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -519,7 +519,7 @@ environment SPEC.\n\n"));
       else
 	{
 	  argv += 1;
-	  argc += 1;
+	  argc -= 1;
 	}
     }
 #else
@@ -544,7 +544,7 @@ environment SPEC.\n\n"));
 	{
 	  spec = &argv[1][2];
 	  argv += 1;
-	  argc += 1;
+	  argc -= 1;
 	}
     }
   else
-- 
2.31.1


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix argv overrun in getconf (bug 27761)
  2021-04-21 12:56 Fix argv overrun in getconf (bug 27761) Andreas Schwab
@ 2021-04-21 13:08 ` Florian Weimer
  2021-04-21 14:28 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2021-04-21 13:08 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

* Andreas Schwab:

> Correct argument counter accounting when processing the -v option with the
> argument directly attached.

Looks okay, thanks.  Do we need to add a test?  Probably not.

Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix argv overrun in getconf (bug 27761)
  2021-04-21 12:56 Fix argv overrun in getconf (bug 27761) Andreas Schwab
  2021-04-21 13:08 ` Florian Weimer
@ 2021-04-21 14:28 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2021-04-21 14:28 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

On Wed, Apr 21, 2021 at 7:20 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> Correct argument counter accounting when processing the -v option with the
> argument directly attached.
> ---
>  posix/getconf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/posix/getconf.c b/posix/getconf.c
> index efc9623b3b..4dccc9cbf2 100644
> --- a/posix/getconf.c
> +++ b/posix/getconf.c
> @@ -519,7 +519,7 @@ environment SPEC.\n\n"));
>        else
>         {
>           argv += 1;
> -         argc += 1;
> +         argc -= 1;
>         }
>      }
>  #else
> @@ -544,7 +544,7 @@ environment SPEC.\n\n"));
>         {
>           spec = &argv[1][2];
>           argv += 1;
> -         argc += 1;
> +         argc -= 1;
>         }
>      }
>    else
> --
> 2.31.1
>

LGTM.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-21 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 12:56 Fix argv overrun in getconf (bug 27761) Andreas Schwab
2021-04-21 13:08 ` Florian Weimer
2021-04-21 14:28 ` H.J. Lu

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).