aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-03-07 21:45:34 +0100
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-03-07 21:52:13 +0100
commit5452d641200b8595a973c874250a27756f47ccbf (patch)
tree7c2da8ad43a605d4428115c51750680216222447
parent79f5b6080b1b7bd5ac9f7e1aac4fcdee0059ff35 (diff)
ts_51_011: fix bitmask compositing in EF_xPLMNwAcT.enc_act()
This commit fixes two problems (found by semgrep): * "'foo' and 'bar' in list" is incorrect, because it's interpreted as "'foo' and ('bar' in list)". Strings with a non-zero length evaluate to True, thus it's True if at least 'bar' is present. * Copy-pasted 'E-UTRAN NB-S1' checked two times. The first condition is redundant, and the whole block can be re-implemented using two independent 'if' statements. Change-Id: Iceb66160cfb571db8879d3810c55d252c763d320
-rw-r--r--pySim/ts_51_011.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 03d74ad..e4a26a3 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -527,12 +527,10 @@ class EF_xPLMNwAcT(TransRecEF):
if 'cdma2000 1xRTT' in in_list:
u16 |= 0x0010
# E-UTRAN
- if 'E-UTRAN WB-S1' and 'E-UTRAN NB-S1' in in_list:
- u16 |= 0x7000 # WB-S1 and NB-S1
- elif 'E-UTRAN NB-S1' in in_list:
- u16 |= 0x6000 # only WB-S1
- elif 'E-UTRAN NB-S1' in in_list:
- u16 |= 0x5000 # only NB-S1
+ if 'E-UTRAN WB-S1' in in_list:
+ u16 |= 0x6000
+ if 'E-UTRAN NB-S1' in in_list:
+ u16 |= 0x5000
# GSM mess
if 'GSM' in in_list and 'EC-GSM-IoT' in in_list:
u16 |= 0x008C