projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix potential crash during failing PMTU discovery.
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
a144636
..
b6c4fc8
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-2127,7
+2127,7
@@
int check_port(const char *name) {
fprintf(stderr, "Warning: could not bind to port 655. ");
for(int i = 0; i < 100; i++) {
fprintf(stderr, "Warning: could not bind to port 655. ");
for(int i = 0; i < 100; i++) {
-
int port = 0x1000 + (rand() & 0x7fff
);
+
uint16_t port = 0x1000 + prng(0x8000
);
if(try_bind(port)) {
char filename[PATH_MAX];
if(try_bind(port)) {
char filename[PATH_MAX];
@@
-3302,8
+3302,8
@@
int main(int argc, char *argv[]) {
#endif
gettimeofday(&now, NULL);
#endif
gettimeofday(&now, NULL);
- srand(now.tv_sec + now.tv_usec);
crypto_init();
crypto_init();
+ prng_init();
if(optind >= argc) {
return cmd_shell(argc, argv);
if(optind >= argc) {
return cmd_shell(argc, argv);