Fix buffer overrun and use correct size for random u32

pull/153/head
Nicolas Stalder 2019-03-26 01:55:42 +01:00
rodzic 98a209e330
commit 40b9dae38a
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -17,7 +17,7 @@ int __errno = 0;
void rng_get_bytes(uint8_t * dst, size_t sz)
{
uint8_t r[8];
uint8_t r[4];
unsigned int i,j;
for (i = 0; i < sz; i += 4)
{
@ -33,7 +33,7 @@ void rng_get_bytes(uint8_t * dst, size_t sz)
for (j = 0; j < 4; j++)
{
if ((i + j) > sz)
if ((i + j) >= sz)
{
return;
}