MdeModulePkg/RegularExpressionDxe: Add null pointer check

This is the part of commit 3948c510ed.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dongao Guo <dongao.guo@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dongao Guo 2018-10-11 14:57:03 +08:00 committed by Liming Gao
parent 47f15da160
commit 6d665168b0
1 changed files with 1 additions and 0 deletions

View File

@ -1572,6 +1572,7 @@ onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType callout_type,
fe->arg_types[i] = arg_types[i]; fe->arg_types[i] = arg_types[i];
} }
for (i = arg_num - opt_arg_num, j = 0; i < arg_num; i++, j++) { for (i = arg_num - opt_arg_num, j = 0; i < arg_num; i++, j++) {
if(IS_NULL(opt_defaults))return ONIGERR_INVALID_ARGUMENT;
if (fe->arg_types[i] == ONIG_TYPE_STRING) { if (fe->arg_types[i] == ONIG_TYPE_STRING) {
OnigValue* val = opt_defaults + j; OnigValue* val = opt_defaults + j;
UChar* ds = onigenc_strdup(enc, val->s.start, val->s.end); UChar* ds = onigenc_strdup(enc, val->s.start, val->s.end);