diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-27 21:28:17 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-28 05:53:22 +0000 |
commit | dd3b977d09e5605973836223ff3fb8a6b83dd6c5 (patch) | |
tree | acf1b2e8218ce7ee448c0d7a365398b6b001038a | |
parent | 6500a660c2285aa558be58b084de9554fccdfc09 (diff) |
POP: ensure that line buffer is NULL terminated
Bug: 13054
Change-Id: Id3bdbaa1b8d6d445daaa66d922bac74ec097b79b
Reviewed-on: https://code.wireshark.org/review/18511
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r-- | epan/dissectors/packet-pop.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dissectors/packet-pop.c b/epan/dissectors/packet-pop.c index efb963bb8c..fbf556c9e1 100644 --- a/epan/dissectors/packet-pop.c +++ b/epan/dissectors/packet-pop.c @@ -171,7 +171,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * call won't throw an exception. */ linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); - line = tvb_get_ptr(tvb, offset, linelen); + line = wmem_strndup(wmem_packet_scope(), tvb_get_ptr(tvb, offset, linelen), linelen); if (pinfo->match_uint == pinfo->destport) { is_request = TRUE; @@ -294,7 +294,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) if (data_val->msg_request) { /* this is a response to a RETR or TOP command */ - if (g_ascii_strncasecmp(line, "+OK ", 4) == 0 && strlen(line) > 4) { + if (g_ascii_strncasecmp(line, "+OK ", 4) == 0 && linelen > 4) { /* the message will be sent - work out how many bytes */ data_val->msg_read_len = 0; data_val->msg_tot_len = 0; |