From: Paul Durrant Date: Wed, 5 Aug 2015 11:58:45 +0000 (+0100) Subject: Fix potential NULL-pointer dereference... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ecf23191be505c5433b58a7c89afb9356866fa0e;p=people%2Fpauldu%2Fxenbus.git Fix potential NULL-pointer dereference... ...in parsing SystemStartOptions. Signed-off-by: Paul Durrant --- diff --git a/src/common/registry.c b/src/common/registry.c index 2389c33..d6499c1 100644 --- a/src/common/registry.c +++ b/src/common/registry.c @@ -1155,13 +1155,13 @@ RegistryQuerySystemStartOption( Length = (ULONG)strlen(Prefix); Option = __strtok_r(Ansi[0].Buffer, " ", &Context); - if (strncmp(Prefix, Option, Length) == 0) - goto found; - - while ((Option = __strtok_r(NULL, " ", &Context)) != NULL) + while (Option != NULL) { if (strncmp(Prefix, Option, Length) == 0) goto found; + Option = __strtok_r(NULL, " ", &Context); + } + status = STATUS_OBJECT_NAME_NOT_FOUND; goto fail3;