aboutsummaryrefslogtreecommitdiffstats
path: root/epan/charsets.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2019-01-07 14:41:29 -0800
committerGerald Combs <gerald@wireshark.org>2019-01-08 00:32:45 +0000
commit3aad1ef236e6c610f25bd8cfc13c2bb1830f207c (patch)
treed8fd407aff4a34a0e82af8fd70d2ff7b71b3ab07 /epan/charsets.c
parente49ec73fc712b34cd61b825fbd3c07223ba01ad5 (diff)
epan: Add a boundary check to get_t61_string.
Add a boundary check to make sure we don't go past the end of "ptr". Bug: 15373 Change-Id: I85394e8e6e477b47919362af146051cc8911254b Reviewed-on: https://code.wireshark.org/review/31437 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/charsets.c')
-rw-r--r--epan/charsets.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/charsets.c b/epan/charsets.c
index d713c45dfe..1973039c6f 100644
--- a/epan/charsets.c
+++ b/epan/charsets.c
@@ -1430,7 +1430,7 @@ get_t61_string(wmem_allocator_t *scope, const guint8 *ptr, gint length)
for (i = 0, c = ptr; i < length; c++, i++) {
if (!t61_tab[*c]) {
wmem_strbuf_append_unichar(strbuf, UNREPL);
- } else if ((*c & 0xf0) == 0xc0) {
+ } else if (i < length - 1 && (*c & 0xf0) == 0xc0) {
gint j = *c & 0x0f;
/* If this is the end of the string, or if the base
* character is just a space, treat this as a regular