aboutsummaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-10-07 16:27:53 +0900
committerJunio C Hamano <gitster@pobox.com>2017-10-07 16:27:53 +0900
commitbd40f41b7b894f9e9258e15acd3620c71c6c4a67 (patch)
tree427355de00c51692eda264a022a7685d5f8e4124 /t/helper
parentaae4788eee306cd4923b765cc4768fee2e7ca13e (diff)
parent97487ea11a2c68934927e515616c133e543a72ce (diff)
downloadgit-bd40f41b7b894f9e9258e15acd3620c71c6c4a67.tar.gz
git-bd40f41b7b894f9e9258e15acd3620c71c6c4a67.tar.xz
Merge branch 'rs/qsort-s'
* rs/qsort-s: test-stringlist: avoid buffer underrun when sorting nothing
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-string-list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index c502fa16d..829ec3d7d 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -108,7 +108,7 @@ int cmd_main(int argc, const char **argv)
* Split by newline, but don't create a string_list item
* for the empty string after the last separator.
*/
- if (sb.buf[sb.len - 1] == '\n')
+ if (sb.len && sb.buf[sb.len - 1] == '\n')
strbuf_setlen(&sb, sb.len - 1);
string_list_split_in_place(&list, sb.buf, '\n', -1);