Hello,


Posting this on behalf of "Amitanand Chikorde 
<amitanand.chiko...@kpit.com<mailto:amitanand.chiko...@kpit.com>>"



From: "Amitanand.Chikorde" 
<amitanand.chiko...@kpit.com<mailto:amitanand.chiko...@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.chiko...@kpit.com<mailto:amitanand.chiko...@kpit.com>>
Signed-off-by: Saloni Jain <saloni.j...@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.chiko...@kpit.com<mailto:amitanand.chiko...@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.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#139555): 
https://lists.openembedded.org/g/openembedded-core/message/139555
Mute This Topic: https://lists.openembedded.org/mt/74913988/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to