archive-tar: use parse_config_key when parsing config
authorJeff King <peff@peff.net>
Wed, 23 Jan 2013 06:23:27 +0000 (01:23 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Jan 2013 16:41:50 +0000 (08:41 -0800)
commit785a04298177e155dc7391e7234945b38b624e34
treef952b01753afe3f46393957ba3b13484153d432d
parent1b86bbb0ade4641c2da0dc74ebca1c09ec772bb4
archive-tar: use parse_config_key when parsing config

This is fewer lines of code, but more importantly, fixes a
bogus pointer offset. We are looking for "tar." in the
section, but later assume that the dot we found is at offset
9, not 3. This is a holdover from an earlier iteration of
767cf45 which called the section "tarfilter".

As a result, we could erroneously reject some filters with
dots in their name, as well as read uninitialized memory.

Reported by (and test by) RenĂ© Scharfe.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive-tar.c
t/t5000-tar-tree.sh