Skip to content

Commit

Permalink
Prevent potential buffer overflow on enclen
Browse files Browse the repository at this point in the history
Follow up of 1d2d25d
  • Loading branch information
mame committed Dec 12, 2022
1 parent e1f4284 commit be18b60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion regenc.h
Expand Up @@ -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)
Expand Down

0 comments on commit be18b60

Please sign in to comment.