mocp segfault with cwd=null when parsing files

I have a folder containing a bunch of mp3's, and a .m3u file with the playlist in it, then there seems to be a random (empty) .txt file in the folder.

If I invoke moc with 'mocp *' (I know this is probably bad to do, but I was lazy), it segfaults, with the following backtrace. You can see that cwd is 0x0, and that is what is being passed to strcpy. If I remove the .txt file and invoke 'mocp *' again it does not segfault, interestingly enough. Let me know if I can get more context via the debugger for you. I realize I am being a 'dumb user' by doing 'mocp *', but the app probably shouldn't crash.

I am using Gentoo's version of mocp, compiled from 2.5.0_alpha4_p20120501-r1, which I assume is a checkout of the alpha4 from the date specified (I'm not the maintainer). There are other 2.5.0_alpha4 packages available but I figured I'd use the latest one available to me in case the bug had been fixed.

Program received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 0x00007ffff697eeb6 in __strcpy_ssse3 () from /lib64/libc.so.6
#1 0x00000000004367ef in make_path (buf=0x7fffffff8710 "", buf_size=8192, cwd=0
x0, path=0x75d020 "01_born_under_punches_(the_heat_goes_on).mp3") at playlis
t_file.c:54
#2 0x0000000000436b71 in plist_load_m3u (plist=0x6ff600, fname=0x7fffffffa7f0 "
/home/dave/Talking Heads - Remain In Light/album.m3u", cwd=0x0, load_serial=0) at pl
aylist_file.c:154
#3 0x0000000000437502 in plist_load (plist=0x6ff600, fname=0x7fffffffa7f0 "/hom
e/dave/Talking Heads - Remain In Light/album.m3u", cwd=0x0, load_serial=0) at playli
st_file.c:408
#4 0x000000000041f23c in process_args (args=0x6fe140) at interface.c:1546
#5 0x00000000004229dc in init_interface (sock=12, logging=0, args=0x6fe140) at
interface.c:3444
#6 0x0000000000413864 in start_moc (params=0x7fffffffd900, args=0x6fe140) at ma
in.c:205
#7 0x0000000000414bbf in main (argc=3, argv=0x7fffffffda98) at main.c:842

This problem was caused by having a playlist with relative file entries amongst others on the command line. That the other file happened to be empty in this case was not related.

MOC now resolves the playlist's relative paths with respect to the directory of the playlist (or of the symlink being used to reference it).

Committed to SVN as r2477.