summaryrefslogtreecommitdiff
path: root/t/t4013/diff.diff_--dirstat-by-file_initial_rearrange
diff options
context:
space:
mode:
authorLibravatar Đoàn Trần Công Danh <congdanhqx@gmail.com>2020-04-21 06:54:35 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-04-22 14:01:02 -0700
commit2a2ff6039606b93ad08d8d377804ddcd0bc41312 (patch)
tree1e44eb3de7c5ca3631ae16da67e7c2c65406e49c /t/t4013/diff.diff_--dirstat-by-file_initial_rearrange
parentt4254: merge 2 steps of a single test (diff)
downloadtgif-2a2ff6039606b93ad08d8d377804ddcd0bc41312.tar.xz
mailinfo.c: avoid strlen on strings that can contains NUL
We're passing buffer from strbuf to reencode_string, which will call strlen(3) on that buffer, and discard the length of newly created buffer. Then, we compute the length of the return buffer to attach to strbuf. During this process, we introduce a discrimination between mail originally written in utf-8 and other encoding. * if the email was written in utf-8, we leave it as is. If there is a NUL character in that line, we complains loudly: error: a NUL byte in commit log message not allowed. * if the email was written in other encoding, we truncate the data as the NUL character in that line, then we used the truncated line for the metadata. We can do better by reusing all the available information, and call the underlying lower level function that will be called indirectly by reencode_string. By doing this, we will also postpone the NUL character processing to the commit step, which will complains about the faulty metadata. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_--dirstat-by-file_initial_rearrange')
0 files changed, 0 insertions, 0 deletions