Module: kamailio
Branch: master
Commit: 6cc563b1b73bfa07911d3e6e3f35d744eb952fbf
URL:
https://github.com/kamailio/kamailio/commit/6cc563b1b73bfa07911d3e6e3f35d74…
Author: Henning Westerholt <hw(a)skalatan.de>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2019-09-01T17:08:05+02:00
lost: use portable kamailio rand() wrapper instead of direct library call
---
Modified: src/modules/lost/utilities.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6cc563b1b73bfa07911d3e6e3f35d74…
Patch:
https://github.com/kamailio/kamailio/commit/6cc563b1b73bfa07911d3e6e3f35d74…
---
diff --git a/src/modules/lost/utilities.c b/src/modules/lost/utilities.c
index cfd2dbe3ab..966e93b033 100644
--- a/src/modules/lost/utilities.c
+++ b/src/modules/lost/utilities.c
@@ -45,6 +45,7 @@
#include "../../core/dprint.h"
#include "../../core/mem/mem.h"
#include "../../core/mem/shm_mem.h"
+#include "../../core/rand/kam_rand.h"
#include "pidf.h"
#include "utilities.h"
@@ -85,9 +86,9 @@ void lost_rand_str(char *dest, size_t lgth)
char charset[] = "0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- srand(time(NULL));
+ kam_srand(time(NULL));
while(lgth-- > 0) {
- index = (double)rand() / RAND_MAX * (sizeof charset - 1);
+ index = (double)kam_rand() / RAND_MAX * (sizeof charset - 1);
*dest++ = charset[index];
}
*dest = '\0';