diff --git a/src/encode/lzh.c b/src/encode/lzh.c index 77a84f90e6d01d8abacf7d12cd7cb49a9bfbc816..70e7447c8380f3fd60afbd0b152463c31a1f75b5 100644 --- a/src/encode/lzh.c +++ b/src/encode/lzh.c @@ -468,7 +468,7 @@ static void lzh_update(lzh_t* lzh, short int c) c = l; } - } while (((c = lzh->prnt[c]) != 0) && c < (sizeof(lzh->son)/sizeof(lzh->son[0]))); /* do it until reaching the root */ + } while (((c = lzh->prnt[c]) != 0) && c < ((sizeof(lzh->son)/sizeof(lzh->son[0]))-1)); /* do it until reaching the root */ } static void lzh_encode_char(lzh_t* lzh, unsigned short c, uint8_t *outbuf, int32_t *outlen)