gunixfdlist: Fix a potential NULL pointer dereference
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 26 Nov 2013 11:11:21 +0000 (11:11 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 27 Nov 2013 10:01:29 +0000 (10:01 +0000)
commitaa28ced44e0460fb01406aa17996d863ffe3cbf6
treeb57e255d9e7b0e79ac487d836f2f1a8258ac3eb6
parent956c58c7f202009d769aefc9bc8adaedccec074d
gunixfdlist: Fix a potential NULL pointer dereference

In the case that (n_fds == 0 && fds == NULL), memcpy() would be called
against a NULL src pointer. Even though the number of bytes to copy is
0, avoid the possibility of a crash by only calling if fds is non-NULL.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
gio/gunixfdlist.c