Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2376?usp=email
to review the following change.
Change subject: tapctl: don't crash on a missing list --hwid value
......................................................................
tapctl: don't crash on a missing list --hwid value
"tapctl list --hwid" without a value crashed in wcslen(), and a value
too long for the hardware ID buffer made memcpy_s() fail.
Warn and ignore --hwid in both cases, as the create command does.
Change-Id: I21c051e6fa7b89904da2d4d6ec4770c94bc44af7
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/tapctl/main.c
1 file changed, 13 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/76/2376/1
diff --git a/src/tapctl/main.c b/src/tapctl/main.c
index 6697d14..12ab270 100644
--- a/src/tapctl/main.c
+++ b/src/tapctl/main.c
@@ -512,11 +512,20 @@
{
if (wcsicmp(argv[i], L"--hwid") == 0)
{
+ if (++i >= argc)
+ {
+ fwprintf(stderr, L"--hwid option requires a value.
Ignored.\n");
+ break;
+ }
+ /* leave room for the two terminating zeros */
+ size_t len = wcslen(argv[i]);
+ if (len > _countof(szzHwId) - 2)
+ {
+ fwprintf(stderr, L"--hwid value is too long. Ignored.\n");
+ continue;
+ }
memset(szzHwId, 0, sizeof(szzHwId));
- ++i;
- memcpy_s(szzHwId,
- sizeof(szzHwId) - 2 * sizeof(WCHAR),
- argv[i], wcslen(argv[i]) * sizeof(WCHAR));
+ wmemcpy(szzHwId, argv[i], len);
}
else
{
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2376?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I21c051e6fa7b89904da2d4d6ec4770c94bc44af7
Gerrit-Change-Number: 2376
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel