Fix out of bounds access

Bug: 34618607
Change-Id: I84f0ef948414d0b2d54e8948b6c30b8ae4da2b36
(cherry picked from commit d1c19c57f66d91ea8033c8fa6510a8760a6e663b)

static size_t StringSize(const uint8_t *start, size_t limit, uint8_t encoding) {

 if (encoding == 0x00 || encoding == 0x03) {
 return strnlen((const char *)start, limit) + 1;
 }

 size_t n = 0;
 while ((n+1 < limit) && (start[n] != '\0' || start[n + 1] != '\0')) {
        n += 2;
 }
    n += 2;
 return n;
}

static size_t StringSize(const uint8_t *start, size_t limit, uint8_t encoding) {

 if (encoding == 0x00 || encoding == 0x03) {
 return strnlen((const char *)start, limit) + 1;
 }

 size_t n = 0;
 while ((n+1 < limit) && (start[n] != '\0' || start[n + 1] != '\0')) {
        n += 2;
 }
    n += 2;
 return n;
}
