diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2010-02-08 00:30:20 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-07 15:40:27 -0800 |
commit | fe12d8e84f745303d64757307e9a6a81a6608018 (patch) | |
tree | 0e0fbad1cb5efcb49c893c5a94f2bcbdc15754af /t/t4013/diff.diff-tree_-r_initial | |
parent | Update git fsck --full short description to mention packs (diff) | |
download | tgif-fe12d8e84f745303d64757307e9a6a81a6608018.tar.xz |
archive: simplify archive format guessing
The code to guess an output archive's format consumed any --format
options and built a new one. Jonathan noticed that it does so in an
unsafe way, risking to overflow the static buffer fmt_opt.
Change the code to keep the existing --format options intact and to only
add a new one if a format could be guessed based on the output file name.
The new option is added as the first one, allowing the existing ones to
overrule it, i.e. explicit --format options given on the command line win
over format guesses, as before.
To simplify the code further, format_from_name() is changed to return the
full --format option, thus no potentially dangerous sprintf() calls are
needed any more.
Reported-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff-tree_-r_initial')
0 files changed, 0 insertions, 0 deletions