mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Add an assortment of extra safety checks.
[originally from svn r9896]
This commit is contained in:
parent
ac8baf4cac
commit
8b6a8b617f
2
import.c
2
import.c
@ -290,7 +290,7 @@ static int ssh2_read_mpint(void *data, int len, struct mpint_pos *ret)
|
||||
if (len < 4)
|
||||
goto error;
|
||||
bytes = GET_32BIT(d);
|
||||
if (len < 4+bytes)
|
||||
if (bytes < 0 || len-4 < bytes)
|
||||
goto error;
|
||||
|
||||
ret->start = d + 4;
|
||||
|
4
sshdss.c
4
sshdss.c
@ -43,6 +43,8 @@ static void getstring(char **data, int *datalen, char **p, int *length)
|
||||
if (*datalen < 4)
|
||||
return;
|
||||
*length = GET_32BIT(*data);
|
||||
if (*length < 0)
|
||||
return;
|
||||
*datalen -= 4;
|
||||
*data += 4;
|
||||
if (*datalen < *length)
|
||||
@ -98,7 +100,7 @@ static void *dss_newkey(char *data, int len)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!p || memcmp(p, "ssh-dss", 7)) {
|
||||
if (!p || slen != 7 || memcmp(p, "ssh-dss", 7)) {
|
||||
sfree(dss);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user