]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ndisc: clear ndisc captive portal value on bogus zero-len option
authorRonan Pigott <ronan@rjp.ie>
Mon, 3 Jul 2023 07:36:04 +0000 (00:36 -0700)
committerRonan Pigott <ronan@rjp.ie>
Mon, 3 Jul 2023 08:10:41 +0000 (01:10 -0700)
This value was freed but erroneously never cleared, leading to
use-after-free.

Fixes: 9747955d2d60 ("ndisc: parse RFC8910 captive portal ipv6ra option")
src/network/networkd-ndisc.c

index da5312c5ff47cfe8325ff04d47a9c4e3d4315d97..025deeff90055c62c687181e1b003d7f8dc5e53c 100644 (file)
@@ -734,7 +734,7 @@ static int ndisc_router_process_captive_portal(Link *link, sd_ndisc_router *rt)
                 return r;
 
         if (len == 0) {
-                mfree(link->ndisc_captive_portal);
+                link->ndisc_captive_portal = mfree(link->ndisc_captive_portal);
                 return 0;
         }