Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1272?usp=email
to look at the new patch set (#2).
Change subject: Silence compiler truncation warning by checking snprintf return
value
......................................................................
Silence compiler truncation warning by checking snprintf return value
On the more recent mingw compilers (homebrew mingw 13.0.0, GCC 15.2.0) the
compiler complains about a potential truncation in these two places.
src/openvpn/tun.c:3806:57:
error: '%s' directive output may be truncated writing up
to 255 bytes into a region of size 178
[-Werror=format-truncation=]
This not very helpful but checking the snprintf return value
will make the compiler not warn about this.
Change-Id: I54b11a5540fb236580a3b80c6d1e8678b24bd852
Signed-off-by: Arne Schwabe <[email protected]>
---
M src/openvpn/tun.c
1 file changed, 14 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1272/2
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 06b7ae5..8b2d5f4 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -3803,7 +3803,12 @@
msg(M_FATAL, "Error enumerating registry subkeys of key: %s",
ADAPTER_KEY);
}
- snprintf(unit_string, sizeof(unit_string), "%s\\%s", ADAPTER_KEY,
enum_name);
+ int ret = snprintf(unit_string, sizeof(unit_string), "%s\\%s",
ADAPTER_KEY, enum_name);
+
+ if (ret < 0 || ret >= sizeof(unit_string))
+ {
+ msg(M_FATAL, "Error constructing unit string for %s", enum_name);
+ }
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, unit_string, 0, KEY_READ,
&unit_key);
@@ -3912,8 +3917,14 @@
msg(M_FATAL, "Error enumerating registry subkeys of key: %s",
NETWORK_CONNECTIONS_KEY);
}
- snprintf(connection_string, sizeof(connection_string),
"%s\\%s\\Connection",
- NETWORK_CONNECTIONS_KEY, enum_name);
+ int ret = snprintf(connection_string, sizeof(connection_string),
"%s\\%s\\Connection",
+ NETWORK_CONNECTIONS_KEY, enum_name);
+
+ if (ret < 0 || ret >= sizeof(connection_string))
+ {
+ msg(M_FATAL, "Error constructing connection string for %s",
enum_name);
+ }
+
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string, 0,
KEY_READ, &connection_key);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1272?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I54b11a5540fb236580a3b80c6d1e8678b24bd852
Gerrit-Change-Number: 1272
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel