Fix leaks in route.
PATCH 1/1 Fix leaks in route.
--- src/openvpn/route.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/route.c +2 -0
@@ -1584,6 +1584,7 @@ add_route(struct route_ipv4 *r,if (!(r->flags &RT_DEFINED )) { +argv_free (&argv);return ; }
@@ -1891,6 +1892,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,if (!(r6->flags &RT_DEFINED ) ) { +argv_free (&argv);return ; }
--
2.17.1
ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom
Hi,
Quoted 1 line · David Korczynski
Signed-off-by David Korczynski <[email protected]...>
Some commit message is always good - just to give context to the reader without the need to look at the rest of the code.
But if Gert is fine without it, I am fine too.
Quoted 17 lines
--- src/openvpn/route.c | 2 ++ 1 file changed, 2 insertions(+)src/openvpn/route.c +1
-0@@ -1584,6 +1584,7 @@ add_route(struct route_ipv4 *r,if (!(r->flags &RT_DEFINED )) { +argv_free (&argv);return ; }
src/openvpn/route.c add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, · line 1898
Quoted 7 lines
src/openvpn/route.c +1
-0@@ -1891,6 +1892,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,if (!(r6->flags &RT_DEFINED ) ) { +argv_free (&argv);return ; }
I agree with Gert that not having RT_DEFINED is indeed impossible with the current code, because that flag is always set when creating a route. However, this function does not know about it and it is correct to keep this check.
Since we keep this check, we indeed need to properly bail out and do not leak.
Thanks for noticing and fixing this!
Signature · 1 line
Antonio Quartulli
Hi,
Quoted 7 lines · Antonio Quartulli
Quoted 1 line · David Korczynski
Signed-off-by David Korczynski <[email protected]...>Some commit message is always good - just to give context to the reader without the need to look at the rest of the code.
But if Gert is fine without it, I am fine too.
I am fine, in this case, as there is not really much to say here - maybe add the explanation "we assume that RT_DEFINED is always set, but still, if it is not, we must not leak memory".
I'll merge later today :-)
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Gert and Antonio, I am not sure if you would want me to change the commit message or not. Let me know if you want me to change it and then I will do that.
Quoted 3 lines · Gert Doering
ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom
ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom
Hi,
Quoted 3 lines · david korczynski
Gert and Antonio, I am not sure if you would want me to change the commit message or not. Let me know if you want me to change it and then I will do that.
Nah, I'll adjust the commit message when commiting.
(Our rule is: code is never changed compared to what is on the list, whitespace/comments in code can be adjusted if it makes sense and the author is OK, and commit messages can be adjusted if the commit itself is good but there is grammar errors, a link to trac missing, ...)
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Sounds good, and the rule of committing code sounds good to me! I will be looking to providing more patches based on what the fuzzing finds in the near future.
Quoted 3 lines · Gert Doering
ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom
ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom
[Openvpn-devel] [PATCH applied] Re: Fix argv leaks in add_route() and add_route_ipv6()
In reply to David KorczynskiThanks for your patch. I have not seriously tested (just a basic compile test) as it is "obviously correct" for that special case.
I have extended the commit message a bit to explain why the change was done (this is what Antonio was talking about - "help the casual reader who wants to understand this change in +3 years").
Your patch has been applied to the master, release/2.5 and release/2.4 branch (bugfixes get backported to all supported branches).
commit a11bea18b1c93b260352ec505db15be0ec9431ee (master) commit 5e88f131b55af96782532f3d1e086de4e17260fe (release/2.5) commit f2f64e058b819d07da9125824717e4bc4d8f9a9d (HEAD -> release/2.4)
Author: David Korczynski Date: Wed Jul 14 17:25:33 2021 +0100
Fix argv leaks in add_route() and add_route_ipv6()
Signed-off-by: David Korczynski <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22637.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering