1
1

channels: Fix integer overflow in generate_cookie().

Since the type of rnd[i] is signed char, (rnd[i] >> 4), which is
considered as arithmetic shift by gcc, could be negative, leading
to out-of-bounds read.
Этот коммит содержится в:
Xi Wang 2011-11-25 23:00:13 -05:00 коммит произвёл Andreas Schneider
родитель a4ffaff550
Коммит d404ad7152

Просмотреть файл

@ -1828,7 +1828,7 @@ int ssh_channel_request_sftp( ssh_channel channel){
static ssh_string generate_cookie(void) {
static const char *hex = "0123456789abcdef";
char s[36];
char rnd[16];
unsigned char rnd[16];
int i;
ssh_get_random(rnd,sizeof(rnd),0);