From: Daniel Willmann <dwillmann(a)sysmocom.de>
---
openbsc/src/gprs/gprs_sgsn.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index f40de0b..2af1e97 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -525,7 +525,9 @@ uint32_t sgsn_alloc_ptmsi(void)
int max_retries = 100;
restart:
- ptmsi = rand();
+ if (RAND_bytes(&ptmsi, sizeof(ptmsi)) != 1)
+ goto failed;
+
/* Enforce that the 2 MSB are set without loosing the distance between
* identical values. Since rand() has no duplicate values within a
* period (because the size of the state is the same like the size of
--
2.1.4