void logeventf(char *fmt, ...)
{
va_list ap;
- char stuff[200];
+ char stuff[512];
va_start(ap, fmt);
vsprintf(stuff, fmt, ap);
}
static void ssh2_pkt_getstring(char **p, int *length)
{
+ int len;
*p = NULL;
*length = 0;
if (pktin.length - pktin.savedpos < 4)
return;
- *length = GET_32BIT(pktin.data + pktin.savedpos);
+ len = GET_32BIT(pktin.data + pktin.savedpos);
+ if (len < 0)
+ return;
+ *length = len;
pktin.savedpos += 4;
if (pktin.length - pktin.savedpos < *length)
return;
*/
static int in_commasep_string(char *needle, char *haystack, int haylen)
{
- int needlen = strlen(needle);
+ int needlen;
+ if (!needle || !haystack)
+ return 0; /* protect against null pointers */
+ needlen = strlen(needle);
while (1) {
/*
* Is it at the start of the string?
if (!ispkt)
crWaitUntil(ispkt);
- sha_string(&exhash, pktin.data + 5, pktin.length - 5);
+ if (pktin.length > 5)
+ sha_string(&exhash, pktin.data + 5, pktin.length - 5);
/*
* Now examine the other side's KEXINIT to see what we're up
}
}
if (!cscipher_tobe) {
- bombout(("Couldn't agree a client-to-server cipher (available: %s)", str));
+ bombout(("Couldn't agree a client-to-server cipher (available: %.450s)",
+ str));
crReturn(0);
}
}
}
if (!sccipher_tobe) {
- bombout(("Couldn't agree a server-to-client cipher (available: %s)", str));
+ bombout(("Couldn't agree a server-to-client cipher (available: %.450s)",
+ str));
crReturn(0);
}