Skip to content

Commit 4bf90c1

Browse files
committed
Merge branch 'rs/qsort-s' into maint
* rs/qsort-s: test-stringlist: avoid buffer underrun when sorting nothing
2 parents 3c905dd + 97487ea commit 4bf90c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/helper/test-string-list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int cmd_main(int argc, const char **argv)
108108
* Split by newline, but don't create a string_list item
109109
* for the empty string after the last separator.
110110
*/
111-
if (sb.buf[sb.len - 1] == '\n')
111+
if (sb.len && sb.buf[sb.len - 1] == '\n')
112112
strbuf_setlen(&sb, sb.len - 1);
113113
string_list_split_in_place(&list, sb.buf, '\n', -1);
114114

0 commit comments

Comments
 (0)