ejurgensen/forked-daapd — pull request #49 by mheijkoop (2014-08-14 18:33:02+00:00)
Title: Don't segfault on invalid utf8 while sorting

`strmblen` returns -1 on invalid sequences, which often-but-not-always causes a segfault when passed as length to `stpncpy`.

Stacktrace:

```
(gdb) backtrace
#0 0xb6cf544c in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xb6e4fe0b in u8_stpncpy () from /usr/lib/i386-linux-gnu/libunistring.so.0
#2 0x0805829c in sort_tag_create (sort_tag=0xb5c13f24, src_tag=) at filescanner.c:239
#3 0x00000000 in ?? ()
```

This fixes #48 for as far as I can tell.