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>
This commit is contained in:
Gerald Combs 2019-01-07 14:41:29 -08:00
parent e49ec73fc7
commit 3aad1ef236
1 changed files with 1 additions and 1 deletions

View File

@ -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