]> git.ipfire.org Git - thirdparty/git.git/commit
vcs-svn: make reading of properties binary-safe
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 26 Mar 2011 05:15:10 +0000 (00:15 -0500)
committerJonathan Nieder <jrnieder@gmail.com>
Sat, 26 Mar 2011 05:15:10 +0000 (00:15 -0500)
commite7d04ee147dcbe6af1fa1d2147466696e2be31bc
treeae39bba6d863b5185d08ce46106dff032ecee0e6
parent41b9dd9d4f2f32f8450af59c30f3a7a2fc5a8cc7
vcs-svn: make reading of properties binary-safe

svn-fe errors out on revision 59151 of the ASF repository:

 fatal: invalid dump: unexpected end of file

The proximate cause is a property with an embedded NUL character.
Previously such anomalies were ignored but commit c9d1c8ba
(2010-12-28) introduced a check strlen(val) == len to avoid reading
uninitialized data when a property list ends early and unfortunately
this test does not distinguish between "foo" followed by EOF and the
string "foo\0bar\0baz".

Fix it by using buffer_read_binary to read to a strbuf and checking
the actual length read.  Most consumers of properties still use
C-style strings, so in practice an author or log message with embedded
NULs will be truncated, but a least this way svn-fe won't error out
(fixing the regression).

Reported-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
t/t9010-svn-fe.sh
vcs-svn/svndump.c