2023-05-18 15:30 GMT+09:00, Hex Rabbit <h3xrabbit@xxxxxxxxx>: >> You need to consider Ciphers flex-array size to validate ctxt_len. we >> can get its size using CipherCount in smb2_encryption_neg_context. > > I'm not checking the flex-array size since both `decode_sign_cap_ctxt()` > and `decode_encrypt_ctxt()` have done it, or should I move it out? Yes, We can move it out. Thanks. > > ``` > if (sizeof(struct smb2_encryption_neg_context) + cphs_size > > len_of_ctxts) { > pr_err("Invalid cipher count(%d)\n", cph_cnt); > return; > } > ``` > > ``` > if (sizeof(struct smb2_signing_capabilities) + sign_alos_size > > len_of_ctxts) { > pr_err("Invalid signing algorithm count(%d)\n", sign_algo_cnt); > return; > } > ``` >