random: Properly handle errors when reading from /dev/[u]random
authorTobias Brunner <tobias@strongswan.org>
Mon, 12 Oct 2015 09:04:55 +0000 (11:04 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 29 Oct 2015 15:17:17 +0000 (16:17 +0100)
commit35dbf8af7a9048f3384af181613c352b718f8d8e
tree30e0d3c51f4c6e61d3aa8975b60b9265c6107e7f
parent37a22a166b6f76d8acf4051b8480d592e851072b
random: Properly handle errors when reading from /dev/[u]random

If -1 was returned on the first call to read() `done` got SIZE_MAX
and the function returned TRUE even though no actual random data had
been allocated.

Fixes #1156.
src/libstrongswan/plugins/random/random_rng.c