From: Dongao Guo Date: Thu, 11 Oct 2018 06:57:03 +0000 (+0800) Subject: MdeModulePkg/RegularExpressionDxe: Add null pointer check X-Git-Tag: edk2-stable201903~819 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=6d665168b0b630924a8d535316d053723998d658 MdeModulePkg/RegularExpressionDxe: Add null pointer check This is the part of commit 3948c510edad901bb9f8d23f7bf0f4ae91b5fcde. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dongao Guo Reviewed-by: Liming Gao --- diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c index c71ae5fa70..0a2d6f89e5 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c +++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c @@ -1572,6 +1572,7 @@ onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType callout_type, fe->arg_types[i] = arg_types[i]; } 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) { OnigValue* val = opt_defaults + j; UChar* ds = onigenc_strdup(enc, val->s.start, val->s.end);