From: Junio C Hamano <gitster@pobox.com>
To: Pierre Habouzit <madcoder@debian.org>
Cc: Git ML <git@vger.kernel.org>
Subject: Re: [PATCH] git-quiltimport: fix security risk because of un-sanitized $level.
Date: Wed, 12 Mar 2008 13:55:56 -0700 [thread overview]
Message-ID: <7v63vr64rn.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080312204648.GA28729@artemis.madism.org> (Pierre Habouzit's message of "Wed, 12 Mar 2008 21:46:48 +0100")
Pierre Habouzit <madcoder@debian.org> writes:
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> ---
>
> I assume that nobody will have a series with -p1000 in it :)
> sorry for this gross mistake in the first place.
>
> [ for the inattentive readers $level was used without quoting, for
> good reasons as it's sometime empty and then we don't want to pass
> an empty argument to git-apply, though someone could use that to run
> arbitrary commands, not nice ]
A traditional way to deal with that situation in shell scripts is to use
this idiom:
${var_that_may_not_be_set+"$var_that_may_not_be_set"}
You can use :+ in place of + to also reject empty string on modern
systems.
#!/bin/sh
not_set=t ; unset not_set
is_set=t
report () {
echo "I got $# args"
i=1
for it
do
echo "$i: $it"
i=$(( $i+1 ))
done
echo
}
report sending not_set ${not_set:+"$not_set"} string
report sending is_set ${is_set:+"$is_set"} string
next prev parent reply other threads:[~2008-03-12 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 20:46 [PATCH] git-quiltimport: fix security risk because of un-sanitized $level Pierre Habouzit
2008-03-12 20:55 ` Junio C Hamano [this message]
2008-03-12 22:29 ` Pierre Habouzit
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=7v63vr64rn.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=madcoder@debian.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.