|
| 1 | +--- a/krl.c |
| 2 | ++++ b/krl.c |
| 3 | +@@ -672,6 +672,7 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf) |
| 4 | + break; |
| 5 | + case KRL_SECTION_CERT_SERIAL_BITMAP: |
| 6 | + if (rs->lo - bitmap_start > INT_MAX) { |
| 7 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 8 | + error_f("insane bitmap gap"); |
| 9 | + goto out; |
| 10 | + } |
| 11 | +@@ -1057,6 +1058,7 @@ ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp) |
| 12 | + } |
| 13 | + |
| 14 | + if ((krl = ssh_krl_init()) == NULL) { |
| 15 | ++ r = SSH_ERR_ALLOC_FAIL; |
| 16 | + error_f("alloc failed"); |
| 17 | + goto out; |
| 18 | + } |
| 19 | +--- a/packet.c |
| 20 | ++++ b/packet.c |
| 21 | +@@ -1839,6 +1839,14 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) |
| 22 | + if ((r = sshpkt_get_string_direct(ssh, &d, &len)) != 0) |
| 23 | + return r; |
| 24 | + DBG(debug("Received SSH2_MSG_PING len %zu", len)); |
| 25 | ++ if (!ssh->state->after_authentication) { |
| 26 | ++ DBG(debug("Won't reply to PING in preauth")); |
| 27 | ++ break; |
| 28 | ++ } |
| 29 | ++ if (ssh_packet_is_rekeying(ssh)) { |
| 30 | ++ DBG(debug("Won't reply to PING during KEX")); |
| 31 | ++ break; |
| 32 | ++ } |
| 33 | + if ((r = sshpkt_start(ssh, SSH2_MSG_PONG)) != 0 || |
| 34 | + (r = sshpkt_put_string(ssh, d, len)) != 0 || |
| 35 | + (r = sshpkt_send(ssh)) != 0) |
| 36 | +--- a/ssh-agent.c |
| 37 | ++++ b/ssh-agent.c |
| 38 | +@@ -1207,6 +1207,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp, |
| 39 | + "restrict-destination-v00@openssh.com") == 0) { |
| 40 | + if (*dcsp != NULL) { |
| 41 | + error_f("%s already set", ext_name); |
| 42 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 43 | + goto out; |
| 44 | + } |
| 45 | + if ((r = sshbuf_froms(m, &b)) != 0) { |
| 46 | +@@ -1216,6 +1217,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp, |
| 47 | + while (sshbuf_len(b) != 0) { |
| 48 | + if (*ndcsp >= AGENT_MAX_DEST_CONSTRAINTS) { |
| 49 | + error_f("too many %s constraints", ext_name); |
| 50 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 51 | + goto out; |
| 52 | + } |
| 53 | + *dcsp = xrecallocarray(*dcsp, *ndcsp, *ndcsp + 1, |
| 54 | +@@ -1233,6 +1235,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp, |
| 55 | + } |
| 56 | + if (*certs != NULL) { |
| 57 | + error_f("%s already set", ext_name); |
| 58 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 59 | + goto out; |
| 60 | + } |
| 61 | + if ((r = sshbuf_get_u8(m, &v)) != 0 || |
| 62 | +@@ -1244,6 +1247,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp, |
| 63 | + while (sshbuf_len(b) != 0) { |
| 64 | + if (*ncerts >= AGENT_MAX_EXT_CERTS) { |
| 65 | + error_f("too many %s constraints", ext_name); |
| 66 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 67 | + goto out; |
| 68 | + } |
| 69 | + *certs = xrecallocarray(*certs, *ncerts, *ncerts + 1, |
| 70 | +@@ -1744,6 +1748,7 @@ process_ext_session_bind(SocketEntry *e) |
| 71 | + /* record new key/sid */ |
| 72 | + if (e->nsession_ids >= AGENT_MAX_SESSION_IDS) { |
| 73 | + error_f("too many session IDs recorded"); |
| 74 | ++ r = -1; |
| 75 | + goto out; |
| 76 | + } |
| 77 | + e->session_ids = xrecallocarray(e->session_ids, e->nsession_ids, |
| 78 | +--- a/ssh-sk-client.c |
| 79 | ++++ b/ssh-sk-client.c |
| 80 | +@@ -429,6 +429,7 @@ sshsk_load_resident(const char *provider_path, const char *device, |
| 81 | + } |
| 82 | + if ((srk = calloc(1, sizeof(*srk))) == NULL) { |
| 83 | + error_f("calloc failed"); |
| 84 | ++ r = SSH_ERR_ALLOC_FAIL; |
| 85 | + goto out; |
| 86 | + } |
| 87 | + srk->key = key; |
| 88 | +@@ -440,6 +441,7 @@ sshsk_load_resident(const char *provider_path, const char *device, |
| 89 | + if ((tmp = recallocarray(srks, nsrks, nsrks + 1, |
| 90 | + sizeof(*srks))) == NULL) { |
| 91 | + error_f("recallocarray keys failed"); |
| 92 | ++ r = SSH_ERR_ALLOC_FAIL; |
| 93 | + goto out; |
| 94 | + } |
| 95 | + debug_f("srks[%zu]: %s %s uidlen %zu", nsrks, |
| 96 | +--- a/sshconnect2.c |
| 97 | ++++ b/sshconnect2.c |
| 98 | +@@ -94,7 +94,7 @@ verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh) |
| 99 | + options.required_rsa_size)) != 0) |
| 100 | + fatal_r(r, "Bad server host key"); |
| 101 | + if (verify_host_key(xxx_host, xxx_hostaddr, hostkey, |
| 102 | +- xxx_conn_info) == -1) |
| 103 | ++ xxx_conn_info) != 0) |
| 104 | + fatal("Host key verification failed."); |
| 105 | + return 0; |
| 106 | + } |
| 107 | +@@ -692,6 +692,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) |
| 108 | + |
| 109 | + if ((pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC) { |
| 110 | + debug_f("server sent unknown pkalg %s", pkalg); |
| 111 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 112 | + goto done; |
| 113 | + } |
| 114 | + if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) { |
| 115 | +@@ -702,6 +703,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) |
| 116 | + error("input_userauth_pk_ok: type mismatch " |
| 117 | + "for decoded key (received %d, expected %d)", |
| 118 | + key->type, pktype); |
| 119 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 120 | + goto done; |
| 121 | + } |
| 122 | + |
| 123 | +@@ -721,6 +723,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) |
| 124 | + SSH_FP_DEFAULT); |
| 125 | + error_f("server replied with unknown key: %s %s", |
| 126 | + sshkey_type(key), fp == NULL ? "<ERROR>" : fp); |
| 127 | ++ r = SSH_ERR_INVALID_FORMAT; |
| 128 | + goto done; |
| 129 | + } |
| 130 | + ident = format_identity(id); |
| 131 | +--- a/sshsig.c |
| 132 | ++++ b/sshsig.c |
| 133 | +@@ -877,6 +877,7 @@ cert_filter_principals(const char *path, u_long linenum, |
| 134 | + } |
| 135 | + if ((principals = sshbuf_dup_string(nprincipals)) == NULL) { |
| 136 | + error_f("buffer error"); |
| 137 | ++ r = SSH_ERR_ALLOC_FAIL; |
| 138 | + goto out; |
| 139 | + } |
| 140 | + /* success */ |
0 commit comments