View | Details | Raw Unified | Return to bug 2566 | Differences between
and this patch

Collapse All | Expand All

(-)a/packet.c (-6 / +11 lines)
Lines 1160-1166 ssh_packet_send2_wrapped(struct ssh *ssh) Link Here
1160
{
1160
{
1161
	struct session_state *state = ssh->state;
1161
	struct session_state *state = ssh->state;
1162
	u_char type, *cp, macbuf[SSH_DIGEST_MAX_LENGTH];
1162
	u_char type, *cp, macbuf[SSH_DIGEST_MAX_LENGTH];
1163
	u_char padlen, pad = 0;
1163
	u_int padlen, pad = 0;
1164
	u_int authlen = 0, aadlen = 0;
1164
	u_int authlen = 0, aadlen = 0;
1165
	u_int len;
1165
	u_int len;
1166
	struct sshenc *enc   = NULL;
1166
	struct sshenc *enc   = NULL;
Lines 1218-1230 ssh_packet_send2_wrapped(struct ssh *ssh) Link Here
1218
	if (padlen < 4)
1218
	if (padlen < 4)
1219
		padlen += block_size;
1219
		padlen += block_size;
1220
	if (state->extra_pad) {
1220
	if (state->extra_pad) {
1221
		/* will wrap if extra_pad+padlen > 255 */
1221
		state->extra_pad = roundup(state->extra_pad, block_size);
1222
		state->extra_pad =
1222
		if (state->extra_pad == 0) {
1223
		    roundup(state->extra_pad, block_size);
1223
			r = SSH_ERR_INTERNAL_ERROR;
1224
		pad = state->extra_pad -
1224
			goto out;
1225
		    ((len + padlen) % state->extra_pad);
1225
		}
1226
		pad = state->extra_pad - ((len + padlen) % state->extra_pad);
1226
		DBG(debug3("%s: adding %d (len %d padlen %d extra_pad %d)",
1227
		DBG(debug3("%s: adding %d (len %d padlen %d extra_pad %d)",
1227
		    __func__, pad, len, padlen, state->extra_pad));
1228
		    __func__, pad, len, padlen, state->extra_pad));
1229
		if (pad > 255) {
1230
			r = SSH_ERR_INTERNAL_ERROR;
1231
			goto out;
1232
		}
1228
		padlen += pad;
1233
		padlen += pad;
1229
		state->extra_pad = 0;
1234
		state->extra_pad = 0;
1230
	}
1235
	}

Return to bug 2566