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