ftp: check username len before copy.

Bug: 15891
Change-Id: I5d4f2a130ec391320243d1a96fbdece3660737ff
Reviewed-on: https://code.wireshark.org/review/33820
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
This commit is contained in:
Dario Lombardo 2019-07-02 11:14:11 +02:00 committed by Pascal Quantin
parent 2fd549551c
commit b233df1966
1 changed files with 1 additions and 1 deletions

View File

@ -945,7 +945,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
else if (strncmp(line, "EPRT", tokenlen) == 0)
is_eprt_request = TRUE;
else if (strncmp(line, "USER", tokenlen) == 0) {
if (p_ftp_conv) {
if (p_ftp_conv && linelen - tokenlen > 1) {
p_ftp_conv->username = wmem_strndup(wmem_file_scope(), line + tokenlen + 1, linelen - tokenlen - 1);
p_ftp_conv->username_pkt_num = pinfo->num;
}