<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/alias.c, branch v2.41.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.41.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.41.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2023-04-10T16:53:19Z</updated>
<entry>
<title>rebase -m: fix serialization of strategy options</title>
<updated>2023-04-10T16:53:19Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2023-04-10T09:08:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4960e5c7bdd399e791353bc6c551f09298746f61'/>
<id>urn:sha1:4960e5c7bdd399e791353bc6c551f09298746f61</id>
<content type='text'>
To store the strategy options rebase prepends " --" to each one and
writes them to a file. To load them it reads the file and passes the
contents to split_cmdline(). This roughly mimics the behavior of the
scripted rebase but has a couple of limitations, (1) options containing
whitespace are not properly preserved (this is true of the scripted
rebase as well) and (2) options containing '"' or '\' are incorrectly
parsed and may cause the parser to return an error.

Fix these limitations by quoting each option when they are stored so
that they can be parsed correctly. Now that "--preserve-merges" no
longer exist this change also stops prepending "--" to the options when
they are stored as that was an artifact of the scripted rebase.

These changes are backwards compatible so the files written by an older
version of git can still be read. They are also forwards compatible,
the file can still be parsed by recent versions of git as they treat the
"--" prefix as optional.

Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>alloc.h: move ALLOC_GROW() functions from cache.h</title>
<updated>2023-02-24T01:25:28Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=36bf19589055fb71aac0ed6719dfe5b385adc2bf'/>
<id>urn:sha1:36bf19589055fb71aac0ed6719dfe5b385adc2bf</id>
<content type='text'>
This allows us to replace includes of cache.h with includes of the much
smaller alloc.h in many places.  It does mean that we also need to add
includes of alloc.h in a number of C files.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>alias.c: reject too-long cmdline strings in split_cmdline()</title>
<updated>2022-10-01T04:23:38Z</updated>
<author>
<name>Kevin Backhouse</name>
<email>kevinbackhouse@github.com</email>
</author>
<published>2022-09-28T22:53:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ca6ead81edd4fb1984b69aae87c1189e3025530'/>
<id>urn:sha1:0ca6ead81edd4fb1984b69aae87c1189e3025530</id>
<content type='text'>
This function improperly uses an int to represent the number of entries
in the resulting argument array. This allows a malicious actor to
intentionally overflow the return value, leading to arbitrary heap
writes.

Because the resulting argv array is typically passed to execv(), it may
be possible to leverage this attack to gain remote code execution on a
victim machine. This was almost certainly the case for certain
configurations of git-shell until the previous commit limited the size
of input it would accept. Other calls to split_cmdline() are typically
limited by the size of argv the OS is willing to hand us, so are
similarly protected.

So this is not strictly fixing a known vulnerability, but is a hardening
of the function that is worth doing to protect against possible unknown
vulnerabilities.

One approach to fixing this would be modifying the signature of
`split_cmdline()` to look something like:

    int split_cmdline(char *cmdline, const char ***argv, size_t *argc);

Where the return value of `split_cmdline()` is negative for errors, and
zero otherwise. If non-NULL, the `*argc` pointer is modified to contain
the size of the `**argv` array.

But this implies an absurdly large `argv` array, which more than likely
larger than the system's argument limit. So even if split_cmdline()
allowed this, it would fail immediately afterwards when we called
execv(). So instead of converting all of `split_cmdline()`'s callers to
work with `size_t` types in this patch, instead pursue the minimal fix
here to prevent ever returning an array with more than INT_MAX entries
in it.

Signed-off-by: Kevin Backhouse &lt;kevinbackhouse@github.com&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
</content>
</entry>
<entry>
<title>alias.c: mark split_cmdline_strerror() strings for translation</title>
<updated>2018-11-12T05:47:09Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-11-10T05:16:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a7412ae1342b09f16d659d75da5d25f137800a60'/>
<id>urn:sha1:a7412ae1342b09f16d659d75da5d25f137800a60</id>
<content type='text'>
This function can be part of translated messages. To make sure we
don't have a sentence with mixed languages, mark the strings for
translation, but only use translated strings in places we know we will
output translated strings.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: add and use --list-cmds=alias</title>
<updated>2018-05-21T04:23:14Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-05-20T18:40:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3301d36b29467a05107340e4d9688ebf74335021'/>
<id>urn:sha1:3301d36b29467a05107340e4d9688ebf74335021</id>
<content type='text'>
By providing aliases via --list-cmds=, we could simplify command
collection code in the script. We only issue one git command. Before
this patch that is "git config", after it's "git --list-cmds=". In
"git help" completion case we actually reduce one "git" process (for
getting guides) but that call was added in this series so it does not
really count.

A couple of bash functions are removed because they are not needed
anymore. __git_compute_all_commands() and $__git_all_commands stay
because they are still needed for completing pager.* config and
without "alias" group, the result is still cacheable.

There is a slight (good) change in _git_help() with this patch: before
"git help &lt;tab&gt;" shows external commands (as in _not_ part of git) as
well as part of $__git_all_commands. We have finer control over
command listing now and can exclude that because we can't provide a
man page for external commands anyway.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Move declaration for alias.c to alias.h</title>
<updated>2018-05-21T04:23:14Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-05-20T18:40:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=65b5f9483eafea0ccdea59884da4e00e0cfeee1f'/>
<id>urn:sha1:65b5f9483eafea0ccdea59884da4e00e0cfeee1f</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/alias-case-sensitivity'</title>
<updated>2017-07-20T23:29:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-07-20T23:29:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=099b74b4b267f72dfab916f28a0b17fceb293900'/>
<id>urn:sha1:099b74b4b267f72dfab916f28a0b17fceb293900</id>
<content type='text'>
A recent update broke an alias that contained an uppercase letter.

* js/alias-case-sensitivity:
  alias: compare alias name *case-insensitively*
  t1300: demonstrate that CamelCased aliases regressed
</content>
</entry>
<entry>
<title>alias: compare alias name *case-insensitively*</title>
<updated>2017-07-17T21:00:12Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2017-07-14T08:39:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=643df7e234dda47a4748311361a82df5415b7bc1'/>
<id>urn:sha1:643df7e234dda47a4748311361a82df5415b7bc1</id>
<content type='text'>
It is totally legitimate to add CamelCased aliases, but due to the way
config keys are compared, the case does not matter.

Therefore, we must compare the alias name insensitively to the config
keys.

This fixes a regression introduced by a9bcf6586d1 (alias: use
the early config machinery to expand aliases, 2017-06-14).

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/free-and-null'</title>
<updated>2017-06-24T21:28:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-06-24T21:28:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=50f03c6676ed5ea040dd53272882d3aac2ee1b48'/>
<id>urn:sha1:50f03c6676ed5ea040dd53272882d3aac2ee1b48</id>
<content type='text'>
A common pattern to free a piece of memory and assign NULL to the
pointer that used to point at it has been replaced with a new
FREE_AND_NULL() macro.

* ab/free-and-null:
  *.[ch] refactoring: make use of the FREE_AND_NULL() macro
  coccinelle: make use of the "expression" FREE_AND_NULL() rule
  coccinelle: add a rule to make "expression" code use FREE_AND_NULL()
  coccinelle: make use of the "type" FREE_AND_NULL() rule
  coccinelle: add a rule to make "type" code use FREE_AND_NULL()
  git-compat-util: add a FREE_AND_NULL() wrapper around free(ptr); ptr = NULL
</content>
</entry>
<entry>
<title>coccinelle: make use of the "type" FREE_AND_NULL() rule</title>
<updated>2017-06-16T19:44:03Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-06-15T23:15:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6a83d902073803c4141e02c53decf8c03e35da27'/>
<id>urn:sha1:6a83d902073803c4141e02c53decf8c03e35da27</id>
<content type='text'>
Apply the result of the just-added coccinelle rule. This manually
excludes a few occurrences, mostly things that resulted in many
FREE_AND_NULL() on one line, that'll be manually fixed in a subsequent
change.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
