Skip to content
Snippets Groups Projects
Commit 6ed05449 authored by Karel Slaný's avatar Karel Slaný Committed by Ondřej Surý
Browse files

Added a check.

parent 8c94048f
Branches
Tags
No related merge requests found
......@@ -200,6 +200,14 @@ int kr_answer_write_cookie(const struct knot_sc_private *srvr_data,
return kr_error(ENOMEM);
}
/*
* Function knot_edns_opt_cookie_data_len() returns the sum of its
* parameters or zero. Anyway, let's check again.
*/
if (cookie_len < (cc_len + nonce_len + hash_len)) {
return kr_error(EINVAL);
}
struct knot_sc_input input = {
.cc = cookie,
.cc_len = cc_len,
......@@ -209,7 +217,7 @@ int kr_answer_write_cookie(const struct knot_sc_private *srvr_data,
if (nonce_len) {
kr_nonce_write_wire(cookie + cc_len, nonce_len, nonce);
/* Adjust input for written nonce value. */
input.nonce = cookie + cc_len;
input.nonce_len = nonce_len;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment