static long len, biglen, to_read;
static unsigned char *p;
static int i, pad;
+ static unsigned long realcrc, gotcrc;
crBegin;
while (1) {
pktin.type = pktin.data[pad];
pktin.body = pktin.data+pad+1;
+ realcrc = crc32(pktin.data, biglen-4);
+ gotcrc = (pktin.data[biglen-4] << 24);
+ gotcrc |= (pktin.data[biglen-3] << 16);
+ gotcrc |= (pktin.data[biglen-2] << 8);
+ gotcrc |= (pktin.data[biglen-1] << 0);
+ if (gotcrc != realcrc) {
+ fatalbox("Incorrect CRC received on packet");
+ }
+
if (pktin.type == SSH_MSG_DEBUG) {
/* FIXME: log it */
} else if (pktin.type == SSH_MSG_IGNORE) {
exit(0);
break;
default:
- if (((c >= ' ' && c <= '~') || (c >= 160)) && pos < 40) {
+ if (((c >= ' ' && c <= '~') ||
+ ((unsigned char)c >= 160)) && pos < 40) {
username[pos++] = c;
c_write(&c, 1);
}
exit(0);
break;
default:
- if (((c >= ' ' && c <= '~') || (c >= 160)) && pos < 40)
+ if (((c >= ' ' && c <= '~') ||
+ ((unsigned char)c >= 160)) && pos < 40)
password[pos++] = c;
break;
}