Attention is currently required from: fixeria, laforge.
neels has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/37994?usp=email )
Change subject: coverity CID#272968 CID#272939
......................................................................
Patch Set 1:
(1 comment)
File src/sccp.c:
https://gerrit.osmocom.org/c/libosmo-sccp/+/37994/comment/6e0270a2_d09eb640… :
PS1, Line 167: return 0;
> I'd agree.
i picked 0 because below it says
if (read + 1 >= room) {
LOGP(DSCCP, LOGL_ERROR, "no place for length\n");
return 0;
}
and other places also return 0 for length errors.
so are you guys sure?
I think this function returns the number of bytes processed, and it being static means that it may be very specialized to work with rc == 0.
It also returns -1 right at the bottom, so it seems to be pick n choose
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/37994?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ic6823cf077ef15ef1f6e209bf53384913911f93e
Gerrit-Change-Number: 37994
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 03 Sep 2024 23:46:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: laforge.
neels has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/libasn1c/+/37983?usp=email )
Change subject: coverity CID#57935
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> this shouldn't be fixed here but in the actual asn1c code, and then re-generate the templates here?
oof, gotcha.
--
To view, visit https://gerrit.osmocom.org/c/libasn1c/+/37983?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libasn1c
Gerrit-Branch: master
Gerrit-Change-Id: I23cfbb1cf1fc12ebd4db8e4b58c5e797b2834897
Gerrit-Change-Number: 37983
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 03 Sep 2024 23:36:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/38004?usp=email )
Change subject: src/stream.c: Use sctp_assoc_id 'canary' to detect misisng sinfo
......................................................................
src/stream.c: Use sctp_assoc_id 'canary' to detect misisng sinfo
sctp_rcvinfo() has a successful return path that does *not* fill
the caller-provided sinfo structure. This would be highly unexpected
as we cannot determine the stream_id and PPID then.
Our osmo_io code path already handles that situation correctly
by logging a related error message. The non-osmo-io path however
would silently hide that error.
See also: https://github.com/sctp/lksctp-tools/issues/37
Change-Id: Idf9c0fa4db65ab6ea34a9cb2011400aadf3dd54e
---
M src/stream.c
1 file changed, 7 insertions(+), 1 deletion(-)
Approvals:
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/stream.c b/src/stream.c
index f8cbed6..5033f4c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -279,8 +279,14 @@
int flags = 0;
int ret;
+ /* Canary to detect if kernel returns sinfo; see https://github.com/sctp/lksctp-tools/issues/37 */
+ sinfo.sinfo_assoc_id = 0;
+
ret = sctp_recvmsg(fd, msg->tail, msgb_tailroom(msg), NULL, NULL, &sinfo, &flags);
- return stream_sctp_recvmsg_trailer(log_pfx, msg, ret, &sinfo, flags);
+ if (sinfo.sinfo_assoc_id)
+ return stream_sctp_recvmsg_trailer(log_pfx, msg, ret, &sinfo, flags);
+ else
+ return stream_sctp_recvmsg_trailer(log_pfx, msg, ret, NULL, flags);
}
/*! wrapper for osmo_io asynchronous recvmsg response */
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/38004?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Idf9c0fa4db65ab6ea34a9cb2011400aadf3dd54e
Gerrit-Change-Number: 38004
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37937?usp=email )
Change subject: commands: avoid double lchan patching, get rid of cla_byte getter+setter methods
......................................................................
commands: avoid double lchan patching, get rid of cla_byte getter+setter methods
The SimCardCommands has a cla_byte @property method, which automatically
returns the lchan patched CLA byte. We use cla_byte property to build
the UICC command APDUs inside SimCardCommands and then we hand the APDU
over to the send_apdu* methods. The cla_byte @property method as well
as the send_apdu* methods perform the lchan patching. This means the CLA
byte gets patched twice, which is technically not an issue, but can be
confusing when trying to understand the code.
To fix this, let's remove the @property methods and turn cla_byte into
a normal property again. This is also more accurate since the cla_byte
property originally was introduced to switch between UICC and classic
SIM APDU commands, which have almost identcal APDUs.
Related: OS#6531
Change-Id: I420f8a5f7ff8d9e5ef94d6519fb3716d6c7caf64
---
M pySim/commands.py
1 file changed, 1 insertion(+), 12 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/commands.py b/pySim/commands.py
index 656f71a..f13e18b 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -66,7 +66,6 @@
byte by the respective instance. """
def __init__(self, transport: LinkBase, lchan_nr: int = 0):
self._tp = transport
- self._cla_byte = None
self.sel_ctrl = "0000"
self.lchan_nr = lchan_nr
# invokes the setter below
@@ -76,16 +75,11 @@
def fork_lchan(self, lchan_nr: int) -> 'SimCardCommands':
"""Fork a per-lchan specific SimCardCommands instance off the current instance."""
ret = SimCardCommands(transport = self._tp, lchan_nr = lchan_nr)
- ret.cla_byte = self._cla_byte
+ ret.cla_byte = self.cla_byte
ret.sel_ctrl = self.sel_ctrl
return ret
@property
- def cla_byte(self) -> Hexstr:
- """Return the lchan patched default CLA value for this card."""
- return cla_with_lchan(self._cla_byte, self.lchan_nr)
-
- @property
def max_cmd_len(self) -> int:
"""Maximum length of the command apdu data section. Depends on secure channel protocol used."""
if self.scp:
@@ -93,11 +87,6 @@
else:
return 255
- @cla_byte.setter
- def cla_byte(self, new_val: Hexstr):
- """Set the (raw, without lchan) default CLA value for this card."""
- self._cla_byte = new_val
-
def send_apdu(self, pdu: Hexstr, apply_lchan:bool = True) -> ResTuple:
"""Sends an APDU and auto fetch response data
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37937?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I420f8a5f7ff8d9e5ef94d6519fb3716d6c7caf64
Gerrit-Change-Number: 37937
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38010?usp=email )
Change subject: pySim.esim.saip: Another naming irregularity.
......................................................................
pySim.esim.saip: Another naming irregularity.
The choice member is called df-5gprose but the header is called
'df-5g-prose-header' (note the '-' between '5g' and 'prose'). WTF.
Change-Id: I86004ac2e18a187c26c5e470344908512d21fb9e
---
M pySim/esim/saip/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index bf39025..7b4d04e 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -386,6 +386,7 @@
'pukCodes': 'puk-Header',
'pinCodes': 'pin-Header',
'securityDomain': 'sd-Header',
+ 'df-5gprose': 'df-5g-prose-header',
}
def __init__(self, decoded = None, mandated: bool = True,
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38010?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I86004ac2e18a187c26c5e470344908512d21fb9e
Gerrit-Change-Number: 38010
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38016?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: esim.saip.templates: Fix expand_default_value_pattern for length==0
......................................................................
esim.saip.templates: Fix expand_default_value_pattern for length==0
The original code treated length==0 like length==None (unspecified),
which is wrong.
Change-Id: I39fa1e2b1b9d6d1c671ea37bdbec1d6f97e8a5e7
---
M pySim/esim/saip/templates.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/templates.py b/pySim/esim/saip/templates.py
index 04b2cd4..f69ec7a 100644
--- a/pySim/esim/saip/templates.py
+++ b/pySim/esim/saip/templates.py
@@ -117,9 +117,9 @@
def expand_default_value_pattern(self, length: Optional[int] = None) -> Optional[bytes]:
"""Expand the default value pattern to the specified length."""
- if not length:
+ if length is None:
length = self._default_value_len()
- if not length:
+ if length is None:
raise ValueError("%s does not have a default length" % self)
if not self.default_val:
return None
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38016?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I39fa1e2b1b9d6d1c671ea37bdbec1d6f97e8a5e7
Gerrit-Change-Number: 38016
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>