[Openvpn-devel,v1] cppcheck: Add more printf-style functions
Commit Message
From: Frank Lichtenheld <frank@lichtenheld.com>
Also fix the two issues raised by this.
Change-Id: I8d081c87af0d746a5e3a2382567f04332639622a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2343
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2343
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
@@ -6,6 +6,12 @@
<formatstr />
</arg>
</function>
+ <function name="argv_printf">
+ <formatstr type="printf"/>
+ <arg nr="2">
+ <formatstr />
+ </arg>
+ </function>
<function name="buf_printf">
<formatstr type="printf"/>
<arg nr="2">
@@ -2,6 +2,12 @@
<!-- Only used for the Windows run. Can't be in openvpn-cppcheck-library.cfg
because it conflicts with gnu.cfg. -->
<def>
+ <function name="MsgToEventLog">
+ <formatstr type="printf"/>
+ <arg nr="2">
+ <formatstr />
+ </arg>
+ </function>
<!-- MinGW uses GCC, so we need to handle GCC builtins. gnu.cfg has these,
but we do not load it for Windows. Without this cppcheck does not
understand our likely()/unlikely() macros. -->
@@ -112,7 +112,7 @@
{
struct argv argv = argv_new();
- argv_printf(&argv, "%s link set dev %s up mtu %d", iproute_path, iface, mtu);
+ argv_printf(&argv, "%s link set dev %s up mtu %u", iproute_path, iface, mtu);
argv_msg(M_INFO, &argv);
openvpn_execve_check(&argv, ctx->es, S_FATAL, "Linux ip link set failed");
@@ -466,7 +466,7 @@
size = bytes / sizeof(*data);
if ((size == 0) || (size > 4096)) /* our startup data is 1024 wchars at the moment */
{
- MsgToEventLog(M_SYSERR, L"malformed startup data: %lu bytes received", size);
+ MsgToEventLog(M_SYSERR, L"malformed startup data: %zu bytes received", size);
ReturnError(pipe, ERROR_STARTUP_DATA, L"GetStartupData", 1, &exit_event);
goto err;
}