Skip to content

Commit

Permalink
Fix use of getrandom() for Linux and WITH_TLS=no.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed May 16, 2019
1 parent ef3e52d commit b1298df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Broker:
- Fix detection of incoming v3.1/v3.1.1 bridges. Closes #1263.
- Fix default max_topic_alias listener config not being copied to the in-use
listener when compiled without TLS support.
- Fix random number generation if compiling using WITH_TLS=no and on Linux
with glibc >= 2.25. Without this fix, no random numbers would be generated
for e.g. on broker client id generation, and so clients connecting expecting
this feature would be unable to connect.

Clients:
- Fix -L url parsing when `/topic` part is missing.
Expand Down
2 changes: 1 addition & 1 deletion lib/util_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ int util__random_bytes(void *bytes, int count)
rc = MOSQ_ERR_SUCCESS;
}
#elif defined(__GLIBC__) && __GLIBC_PREREQ(2, 25)
if(getrandom(bytes, count, 0) == 0){
if(getrandom(bytes, count, 0) == count){
rc = MOSQ_ERR_SUCCESS;
}
#elif defined(WIN32)
Expand Down

0 comments on commit b1298df

Please sign in to comment.