Browse Source

Merge branch 'rs/qsort-s' into maint

* rs/qsort-s:
  test-stringlist: avoid buffer underrun when sorting nothing
maint
Junio C Hamano 7 years ago
parent
commit
4bf90c1740
  1. 2
      t/helper/test-string-list.c

2
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 * Split by newline, but don't create a string_list item
* for the empty string after the last separator. * 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); strbuf_setlen(&sb, sb.len - 1);
string_list_split_in_place(&list, sb.buf, '\n', -1); string_list_split_in_place(&list, sb.buf, '\n', -1);



Loading…
Cancel
Save