aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2020-06-13 09:09:27 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2020-10-29 07:37:11 +0100
commit2a435abb4381b616ca614bf02ff0c8f24b99b9b7 (patch)
tree6b48beccd4912cc8abebbda44fde833984738ae6
parentfaf7c7c5c26bf1c395bd4a7933cc731d7b132bf7 (diff)
C-Netz SIM: Terminate phone number string at first 0xf
-rw-r--r--src/sim/sim.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sim/sim.c b/src/sim/sim.c
index 7329801..890e37b 100644
--- a/src/sim/sim.c
+++ b/src/sim/sim.c
@@ -320,6 +320,9 @@ void decode_directory(uint8_t *data, char *number, char *name)
digit = (data[i >> 1] & 0xf) + '0';
if (digit <= '9')
number[j++] = digit;
+ /* stop if we have digit=0xf (end of line) */
+ if (digit == 0xf)
+ break;
}
number[j] = '\0';
}
@@ -684,7 +687,7 @@ static void wt_rufn(sim_sim_t *sim, uint8_t *data, int length)
char number[17];
decode_directory(data + 1, number, NULL);
- /* if number is cleared, we ignore that */
+ /* if number is cleared (no digits), we ignore that */
if (number[0] == '\0')
goto respond;
switch (rufn) {