Prevent potential buffer overflow on enclen

Follow up of 1d2d25dcadda0764f303183ac091d0c87b432566
This commit is contained in:
Yusuke Endoh 2022-12-09 14:19:31 +09:00
parent e1f42844a0
commit be18b60c33
Notes: git 2022-12-12 07:21:50 +00:00

View File

@ -91,7 +91,7 @@ typedef struct {
#define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL
#define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val)
#define enclen(enc,p,e) ((enc->max_enc_len == enc->min_enc_len) ? enc->min_enc_len : ONIGENC_MBC_ENC_LEN(enc,p,e))
#define enclen(enc,p,e) ((enc->max_enc_len == enc->min_enc_len) ? (p < e ? enc->min_enc_len : 0) : ONIGENC_MBC_ENC_LEN(enc,p,e))
/* character types bit flag */
#define BIT_CTYPE_NEWLINE (1<< ONIGENC_CTYPE_NEWLINE)