[strongSwan] [strongswan] davici: Fix codesonar warnings
Saloni Jain
Saloni.Jain at kpit.com
Mon Jun 15 16:31:57 CEST 2020
Hello,
Posting this on behalf of "Amitanand Chikorde <Amitanand.Chikorde at kpit.com>"
From: "Amitanand.Chikorde" <Amitanand.Chikorde at kpit.com>
Fixed below codesonar warning.
isprint() is invoked here with an argument of signed type char, but
only has defined behavior for int arguments that are either
representable as unsigned char or equal to the value of macro EOF(-1).
As per codesonar report, in a number of libc implementations, isprint()
is implemented using lookup tables (arrays): passing in a negative
value can result in a read underrun.
To avoid this unexpected behaviour, typecasted char type argument to
unsigned char type.
Upstream-Status: Pending
Signed-off-by: Amitanand.Chikorde <Amitanand.Chikorde at kpit.com>
Signed-off-by: Rahul Taya <Rahul.Taya at kpit.com>
---
.../files/davici_codesonar_warnings_fix.patch | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 recipes-support/strongswan/files/davici_codesonar_warnings_fix.patch
diff --git a/recipes-support/strongswan/files/davici_codesonar_warnings_fix.patch b/recipes-support/strongswan/files/davici_codesonar_warnings_fix.patch
new file mode 100644
index 0000000..2318479
--- /dev/null
+++ b/recipes-support/strongswan/files/davici_codesonar_warnings_fix.patch
@@ -0,0 +1,37 @@
+davici: Fix codesonar warnings
+
+isprint() is invoked here with an argument of signed type char,
+but only has defined behavior for int arguments that are either
+representable as unsigned char or equal to the value of macro
+EOF(-1).
+
+As per codesonar report, in a number of libc implementations,
+isprint() is implemented using lookup tables (arrays): passing
+in a negative value can result in a read underrun.
+
+To avoid this unexpected behaviour, typecasted char type
+argument to unsigned char type.
+
+Signed-off-by: Amitanand N. Chikorde <Amitanand.Chikorde at kpit.com>
+Upstream-Status: Pending
+
+--- a/davici.c 2017-03-30 16:15:15.000000000 +0530
++++ b/davici.c 2020-05-29 11:40:45.983656217 +0530
+@@ -180,7 +180,7 @@
+ }
+ for (i = 0; i < inlen; i++)
+ {
+- if (!isprint(in[i]))
++ if (!isprint((unsigned char) in[i]))
+ {
+ return -EINVAL;
+ }
+@@ -1157,7 +1157,7 @@
+
+ for (i = 0; i < res->buflen; i++)
+ {
+- if (!isprint(val[i]))
++ if (!isprint((unsigned char) val[i]))
+ {
+ return -EINVAL;
+ }
--
2.7.4
Regards,
Saloni Jain
This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strongswan.org/pipermail/users/attachments/20200615/0885c37a/attachment-0001.html>
More information about the Users
mailing list