mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
solaris/open_tun: prevent crash when dev is empty string
This was originally reported on GH, but never dealt with. Make sure 'ptr' is always initialized to prevent derefence of null pointer in case of empty dev string. While at it, change the if condition to use ptr instead of dev, since dev is not used anymore in the logic. Signed-off-by: Antonio Quartulli <a@unstable.cc> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20220917125811.13549-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25235.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
cac18de7a1
commit
cec4353b60
1 changed files with 3 additions and 2 deletions
|
|
@ -2379,10 +2379,11 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
|
|||
msg(M_ERR, "Can't open %s", dev_node);
|
||||
}
|
||||
|
||||
ptr = dev;
|
||||
|
||||
/* get unit number */
|
||||
if (*dev)
|
||||
if (*ptr)
|
||||
{
|
||||
ptr = dev;
|
||||
while (*ptr && !isdigit((int) *ptr))
|
||||
{
|
||||
ptr++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue