platform: avoid crash after calling nl_recv() for old libnl3 version

nl_recv() in libnl3 before version 3.2.15 would return dangling pointers
if nl_recv() fails or has nothing to read [1].

Workaround that by explicitly clearing @buf and @creds.

https://bugzilla.gnome.org/show_bug.cgi?id=767986

[1] 69468517d0

(cherry picked from commit 66715515dc)
This commit is contained in:
Thomas Haller 2016-06-24 18:59:58 +02:00
parent 78c3d14a68
commit 9bd444b3b1

View file

@ -5792,6 +5792,13 @@ continue_reading:
errno = 0;
n = nl_recv (sk, &nla, &buf, &creds);
if (n <= 0) {
/* workaround libnl3 <= 3.2.15 returning danling pointers in case nl_recv()
* fails. Fixed by libnl3 69468517d0de1675d80f24661ff57a5dbac7275c. */
buf = NULL;
creds = NULL;
}
switch (n) {
case 0:
/* Work around a libnl bug fixed in 3.2.22 (375a6294) */